Closed Arnedeklerk closed 1 year ago
Server side completed here.
The client can use it by adding isSortedEvidenceTable=true
to the /genome
call.
As far as I can see, client changes are to be made in createEvidenceTable()
, and are like:
handleViewCreation()
calls the API with the param above, then it calls createEvidenceTable()
with doSortTable=false
(let's remove this param in future, for the moment, we have to experiment with the performance of this solution).sortList
passed to the table sorter, and force the header ticks on the already-sorted columns, using the approach suggested in StackOverflow (define a 'set initial order' function as mentioned above).Closing. Please note that as of now, tables are rendered in chunks (refer to https://github.com/Rothamsted/knetminer/issues/734) and are no longer sortable by the user. The initial sort is determined by the backend and remains unchanged throughout. This approach was adopted to avoid the need for re-sorting the entire table after every user adjustment, which goes beyond the scope of the current view window.
Currently, the evidence table sorting is being handled on the client side. The performance of this can be improved by getting the initial sorting from the server, as per #727.
After the latter is completed, the client should skip the initial sorting. The code relies on the jquery/table sorter component to manage alternative sorting criteria selected by the user (ie, clicks on table headers), this is to be kept as-is.
A problem with table sorter is that it doesn't know when the data it receives are already sorted, so it doesn't draw the corresponding column header ticks to change the sort order.
Regarding this, we should try this SO solution, ie, write a helper like
TableSorter.setInitialOrder ( columnIndex, isAscending = true )
. Ideally, this would be a method of the table sorter object, if it's too difficult to make it that way, just name it likesetInitialTableSorterOrder()
.