Reloading List Content After Full-Text Search

When the user enters search criteria in the Group, Location, or User form and clicks the search image, the list is repopulated. The topics in the following procedure describe how functions in LoadList.js reload the list, make the initial set of XML records visible in the list, and manage the scroll bars on the list.

To populate the list after full-text search

  1. Assign search Function to onClick Event
  2. Enter Search Criteria
  3. Run Script in DoLoad Function

Assign search Function to onClick Event

The event handler for the onClick event associated with the search image on the Group, Location, and User form views is the search function in the *List.js file for each form view; for example, the Group form uses the search function in GroupList.js. The following code fragment shows how search is specified as the event handler for the search image:

<input LID="inp4" type="image" align="top" src="../images/audit.gif" title="Click to search" onClick="return search()" WIDTH="32" HEIGHT="31" id="image1" name="image1">

Enter Search Criteria

When a user enters search criteria in the searchTerm text box on the Group, Location, or User form and clicks the search icon, the search function is called. This function first calls the reset function in LoadList.js to cancel the current download and reinitialize the TargetTable. The following code fragments from the search function in GroupList.js show how the search criteria is included in the QueryString property of the Request object:

var term = frmSearch.searchTerm.value;

var xml = '../Scripts/viewData.asp?tableName=group&fieldList=GroupId,Name&sortBy=Name&search=' + term;
xmldso.XMLDocument.ondataavailable = noOp; // won't accept null
xmldso.XMLDocument.onreadystatechange = dataAvailable;
xmldso.XMLDocument.load(xml);

When the readystate property of the XMLDocument changes, the dataAvailable function is called. The following code fragment shows how dataAvailable manages race conditions by delaying the call to doLoad by 500 milliseconds:

if (xmldso.XMLDocument.readyState == 4) {
      // even though we are "complete" the recordset hasn't been updated yet.
      // allow a few moments to finish processing the XML...
      setTimeout('doLoad()',500);

After doLoad is called, the process of loading the TargetTable with an initial dataset is identical to the steps described in Run Script in doLoad Function, which is part of Loading the List When Forms First Appear.