Search code examples
xpageslotus-notesxpages-ssjsnotesview

Best way to build a custom table linked to a NotesView with sorting and paging


I have a view in my Xpage application that contains a lot of elements. From this view I need to build a table with custom rows (I can't just display the view, I need to build the rows to display myself because I need to compute data from other database, things that you can't do directly in a view).

In order to do so I know that I can use Dataview, Datatable or repeat control (other ideas maybe?). For sure I can't bring all the data on the client, it's way too much.

I am looking for a solution that will allow me to do paging (easy to do with the pager component) but more important sorting on header click. To be clear, I need sorting for all the entries of the view and not only for the current displayed page on the client.

What can be the more efficient way to do so ? I really have a lot of data to compute so I need the fastest way to do it.

(I can create several views with different sorting criteria if needed).


Solution

  • To keep the processing faster and lightweight, I use JSON with JQuery DataTables. Depending on the Data-size and usage, JSON could be generated on the fly or scheduled basis and saved in Lotus Notes Documents or ApplicationScope variables.

    $.each(data, function(i, item) {
       dataTable.row.add( [data[i].something1,data[i].something2,data[i].something3])
    });