Search these areas:
Help
Support Forums
Product Info



-Introduction
-DataWeb: What's New
-Creating an Application
-The DataWeb Designer
-Application Management
-Data Tables
-Data Tables
-Views
-Templates
-Components
-Data Analysis
-Members
-Security
-Importing
-Exporting
-FTP
-JavaScript
-Object Model
-Full-Text Search
-Domain and Email Hosting
-HotBlock Modules
-Account Management
-Glossary
-New Responsive UI Module





DataWeb Help
Support Forums
Tutorial
Script Library
Knowledge Base

Home > Support

KnowledgeBase


How To: Format the display for a view in details mode
Article TypeHow To
TitleFormat the display for a view in details mode
<i>I want to display a custom format for a view when it's displayed in details mode,
but I want to use the default formatting for the grid, insert, and update modes.</i>
<p><b>Solution</b></p>
<p>To format a view so that it displays a custom format in details mode, but
uses the default formatting for the grid, insert, and update modes, you can use
an HTML block to specify formatting for details mode only. First, set the <i>displaymodes</i>
attribute of the field box to &quot;grid,update,insert&quot;, so that the field
box will not be displayed in details mode. </p>
<p>Next, create an HTML block within the data region, and set its <i>displaymodes</i>
attribute to &quot;details.&quot; You can specify custom formatting for details
mode within the HTML block. To retrieve the data for each field within the HTML
block, use Dataweb substitution syntax and return the value of each named field
property on the <b>record</b> object.</p>
Here is the source XML for a sample view:
<pre>
&lt;ws:dataregion defaultmode=&quot;details&quot;
  actionbarposition=&quot;bottom&quot;
  jumpbarposition=&quot;top&quot;&gt;
  &lt;ws:datasource src=&quot;ExampleData&quot; /&gt;

  &lt;ws:fieldbox displaymodes=&quot;grid,update,insert&quot;&gt;
    &lt;ws:action type=&quot;showupdatepage&quot; displaytype=&quot;image&quot;
      displaymodes=&quot;grid,details&quot; displayrole=&quot;author&quot; /&gt;
      &lt;ws:field name=&quot;FirstName&quot;&gt;
        &lt;ws:caption&gt;First Name&lt;/ws:caption&gt;
      &lt;/ws:field&gt;
      &lt;ws:field name=&quot;LastName&quot;&gt;
        &lt;ws:caption&gt;Last Name&lt;/ws:caption&gt;
      &lt;/ws:field&gt;
      &lt;!--other fields included here...--&gt;
  &lt;/ws:fieldbox&gt;

  &lt;ws:htmlblock displaymodes=&quot;details&quot;&gt;
    &nbsp;#response.encodeHTML
    &nbsp;&nbsp; ( record.FirstName + " " + record.LastName )#:&lt;br /&gt;
    &nbsp;#response.encodeHTML( record.Company )# :&lt;br /&gt;
    &nbsp;#response.encodeHTML( record.Phone )# :&lt;br /&gt;
    &nbsp;#response.encodeHTML( record.Email )# :&lt;br /&gt;
  &lt;/ws:htmlblock&gt;

  &lt;ws:actionbar&gt; ... &lt;/ws:actionbar&gt;
  &lt;ws:caption&gt;Contacts&lt;/ws:caption&gt;
&lt;/ws:dataregion&gt;
</pre>
Note that, within the <b>ws:fieldbox</b> tag, we use the <b>ws:field</b> tag to
retrieve the value of a field:
<ul>
  <li>&lt;ws:field name=&quot;<i>columnname</i>&quot;&gt; &lt;/ws:field&gt;</li>
</ul>
Within the <b>ws:htmlblock</b> tag, we use Dataweb substitution syntax to refer
to the <b>record</b> object:
<ul>
  <li>#response.encodeHTML( record.<i>columnname</i> )#</li>
</ul>
To ensure our field data is properly escaped, we use the <b>encodeHTML</b> method of the <b>response</b> object.<br>
<br>
Note also that to refer to a field as a property of the <b>record</b> object,
that field must be included in a <b>ws:field</b> tag inside the data region. If
there is a field that you want to display using Dataweb substitution syntax but
not in the field box, set the <i>displaymodes</i> attribute to <i>&quot;never&quot;</i>
for that field's <b>ws:field</b> tag.<br>
<br>
Last ReviewedFebruary 20, 2015 14:07:57

  
Affiliate | Partner | Terms of Use | Privacy Policy | Contact Us | Pricing | Bring DataWeb In-House    
DataWeb, 720 North 10th Street, A #145, Renton, Washington 98057 *425-583-5970* Fax 484-770-4706* Email Us