سؤال

My XPage has a view data source with a search formula ("Search in view results") constructed from URL parameters.

The search results are displayed in a repeat control that sits inside a panel. I want to hide this panel if there are no search results and display an appropriate message instead.

The panel is visible based on the following code:

var vec:NotesViewEntryCollection = view1.getAllEntries();
vec.getCount() != 0;

However it seems that getAllEntries returns all entries in the view before the filtering takes place. The Help for AllEntries says "If a view is filtered by FTSearch, this property returns the entries in the filtered view."

Have I misunderstood this? Is there a way that I can get the number of entries AFTER the filtering has taken place?

هل كانت مفيدة؟

المحلول

When you're accessing the dominoView datasource via SSJS you're not getting the dominoView but the NotesView associated with it. That's why the properties and methods available are for the NotesView class. But the search is being performed on the dominoView datasource front-end not on the NotesView object associated with it.

Instead of using the datasource, get the control that uses it (e.g. A repeat, viewPanel etc) and use the getRowCount() method. This will give you the right total. E.g.

getComponent("repeat1").getRowCount() 

نصائح أخرى

Using the View caption property....

sample: "Displaying 30 of 30220"

<xp:this.caption><![CDATA[#{javascript:return "Displaying " + getComponent("viewPanel1").getRowCount() + " of " + view1.getAllEntries().getCount();}]]></xp:this.caption>

NOTE: This counts the categorized row as well.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top