SetRetrievedRecordCount

Description

This JavaScript function can be used within JSPs created for list views. All list view screens typically have a message next to the title of the screen that indicates how many records were retrieved. For example, the message displays Retrieved 2 record(s) when the list view shows 2 records. You can use this JavaScript to set the count within this message dynamically. Typically, the UI infrastructure automatically displays the correct message based on the output of the "List" API defined under the entity resource for this list view.

However, in some instances the "List" API cannot be used for a specific list view. In these cases, the list view as been set to ignore the default list API, and instead, calls its own API either by defining a different API under the list view resource or within its own JSP through the callAPI taglib. In this case, the UI infrastructure cannot automatically display the correct message.

Syntax

setRetrievedRecordCount (recordCount)

Input parameters

recordCount - Required. The correct record count to display in the "Retrieved X record(s)" message.

Return value

None.

Example

This example shows how to call the setRetrievedRecordCount() function from a JSP defined for a list view. The correct count is computed as JSP code. Then, this result is passed to the setRetrievedRecordCount method which is called inside a script tag:

<%
   YFCElement root = (YFCElement)request.getAttribute("OrganizationList");
   int countElem = countChildElements(root); 
%> 
<script language="javascript">
    setRetrievedRecordCount(<%=countElem%>);
</script>