javasortingxpagesssjs

How to change the sorting column dynamically when getting a NotesViewEntryCollection


I have a viewEntryCollection in SSJS from a sorted view displayed in a repeat which is displaying a table on the web page

I now want the viewEntrycollection do be sorted as any of the other sortable columns in the view. (i.e the user click on a columnn in the table and set a viewScope variable that I can use when I get the entrycollection)

I do not want to resort the entrycollection programmatically and I do not want to update the view design. I just want to change which column the collection use for sorting.

Preferably the same way a viewPanel can be set to be resorted based on specified sorted column.

any ideas?


Solution

  • If you have a NotesViewEntryCollection you retrieved that from a NotesView object. To sort that collection, you need to resort the view object after you've opened it using the resortView("colName", sortAsc); method.

    That will only work if you enabled the 'click to sort column' option for the column you want to sort on.

    If you need more control over how view data is handled (including sorting), have a look at the Domino JNA project and this blog post (disclaimer: I wrote that post).