Reid Rivenburgh
Reid Rivenburgh

Reputation: 403

XPages: Get count of entries in filtered view

This question asks something similar to what I'm about to ask: Count entries in XPages view

Basically, if I provide a Search property for the view, I'll get a subset of the view's total entries. The suggestion in that question is to query the repeat. But in my case, it seems like I can't query the repeat to get the count of entries in the filtered view because I'm using a pager. It only seems to return the number of entries on the current page. Does the view itself not have some mechanism for querying the number of filtered entries? Thanks.

Upvotes: 1

Views: 599

Answers (1)

Knut Herrmann
Knut Herrmann

Reputation: 30970

Just as a workaround: add an additional repeat control to your XPage and get the number of entries from there

<xp:repeat
    id="repeat1"
    rows="0"
    value="#{view1}">
</xp:repeat>

<xp:text
    escape="true"
    id="computedField1"
    value="#{javascript:getComponent('repeat1').getRowCount() }">
</xp:text>

<xp:viewPanel
    value="#{view1}"
    ...

The repeat control is "invisible" in browser as it's empty. rows="0" means no rows limit.

Upvotes: 4

Related Questions