ShowDetailFor
You can review the details about the showDetailFor JavaScript function, which changes the page to show the default view of the current entity.
Description
This JavaScript function changes the current page to show the default view of the current entity. The resulting screen opens in the same browser window, not in a new window. You typically use the showDetailFor() function to move from the list view to the detail view. Then after the detail view opens, this function is not used, because subsequent views are typically invoked as pop-up windows and this function does not do that.
If you do choose to use this function in a detail screen, the following behavior must be kept in mind. This function does a [get] and not a [post]. Therefore, if you see the Next or Previous icons on your screen and you use this function to switch to the default view, the icons are lost. The icons disappear because the hidden input in the current page that contain information regarding the Next or Previous views are lost when this function does a [get].
In a list screen, this function is used in conjunction with the yfc:makeXMLInput JSP tag. The makeXMLInput JSP tag prepares an XML containing the key attributes. That XML must be passed to the default detail view.
Syntax
showDetailFor(entityKey)
Input parameters
entityKey - Required. String containing a URL-encoded XML that contains the key attributes required by the detail view.
Output parameters
None.
Example
This example shows an Order list view that contains two columns: Order Number and Enterprise Code. Order Number is hyperlinked to open the default detail view of Order. Notice that yfc:makeXMLInput prepares an XML that is later used as the input parameter to the showDetailFor() function by using the getParameter() JSP function.
<table class="table" editable="false" width="100%" cellspacing="0">
<thead>
<tr>
<td sortable="no" class="checkboxheader">
<input type="checkbox" name="checkbox" value="checkbox"
onclick="doCheckAll(this);"/>
</td>
<td class="tablecolumnheader"><yfc:i18n>Order_#</yfc:i18n></td>
<td class="tablecolumnheader"><yfc:i18n>Enterprise</yfc:i18n></td>
</tr>
</thead>
<tbody>
<yfc:loopXML binding="xml:/OrderList/@Order" id="Order">
<tr>
<yfc:makeXMLInput name="orderKey">
<yfc:makeXMLKey binding="xml:/Order/@OrderHeaderKey"
value="xml:/Order/@OrderHeaderKey" />
</yfc:makeXMLInput>
<td class="checkboxcolumn">
<input type="checkbox" value='<%=getParameter("orderKey")%>'
name="EntityKey"/>
</td>
<td class="tablecolumn"><a
href="javascript:showDetailFor('<%=getParameter("orderKey")%>');">
<yfc:getXMLValue binding="xml:/Order/@OrderNo"/></a>
</td>
<td class="tablecolumn"><yfc:getXMLValue
binding="xml:/Order/@EnterpriseCode"/></td>
</tr>
</yfc:loopXML>
</tbody>
</table>