Search code examples
full-text-searchxpageslotus-domino

Search in a domino paginated view in XPages


I have a view in an xpage that shows paginated results. Also an edit box that binds to a sessionScope variable. In the data->search property of the view i have set the query string according to the edit box value. When i search for an entry that appears in the 1st page it works but when i search for an entry in the 2nd or other page it does not... Any ideas?

search query code:

var tmpArray = new Array("");
var cTerms = 0;
var qstring = "";
if (sessionScope.name != null & sessionScope.name != "") {
tmpArray[cTerms++] = "(FIELD name = \"" + sessionScope.name + "\")";
}
if (sessionScope.email != null & sessionScope.email != "") {
tmpArray[cTerms++] = "(FIELD email = \"" + sessionScope.email+ "\")";
}
qstring = tmpArray.join(" AND ").trim();
sessionScope.queryString = qstring;
return qstring;

this code works fine but only if the record appears initially(before applying query) in the 1st page.


Solution

  • Yes, the pager does not jumpt to the first page after a search automatically. See http://xpageswiki.com/apps/wiki-xpages/wiki-xpages.nsf/dx/Work_with_views#Force+view+to+go+to+first+page for code to jump to the first page in a view via SSJS.

    Add that code to the onchange event of the edit box, then after hitting enter in the edit box the view panel should perform the search and jump to the first page.