Search code examples
viewxpageslotus-dominopagerrowcount

XPages: how to count paginated view panel rows


I have a view panel in xpages and a computed field to show the row-count. I have 2 problems:

1st: how can i count only the rows of the current page of the pager?it seems that viewPanel.getRowCount() gets all rows from the beginning until the current page, so if i have 30 entries per page and i am in page 2, it shows 60 instead of 30.

2nd: even if i achieve the above, the pager only refreshes the view and i can't refresh the computed field or another panel. Can i put the computed field inside the view panel or make it somehow to be refreshed in each page change? i would prefer not to do it with full page refresh if possible...


Solution

  • Given the computed field refresh issue, even if you managed to get a count of rows (eg on a page-scope SSJS variable), it woudln't update the computed field.

    It might be easier to to count to rows in the HTML table using clientside javascript ?

    something like ..

    page onload event :

    get the HTML table
    get the table rows property (array of rows in the table)
    
    number or rows = that value (1st row = TH (header) row if there is one = row 0)
    

    use javsscript to plug that value into a known DIV