Author Topic: On a sort, I need a row to always be the last row  (Read 273 times)

jplevene

  • Pro Ultimate
  • Full Member
  • *
  • Posts: 131
    • View Profile
On a sort, I need a row to always be the last row
« on: April 28, 2024, 12:01:23 am »
I have a special row (it triggers and event when it comes into view) and I always want it to be the last row, even after sorting.

I figured one way as a cheat by either saying the row is more or less than all other rows depending on the sort direction, I just need to get the current sort direction of the column.

Code: [Select]
sortType: function(rowData1, rowData2, dataIndx){
// ALWAYS make sure bottom row is at the bottom
if(is_special_row(rowData1))
return direction_up ? -1 : 1;
else
//compare rowData1[dataIndx] and rowData2[dataIndx]
}

jplevene

  • Pro Ultimate
  • Full Member
  • *
  • Posts: 131
    • View Profile
Re: On a sort, I need a row to always be the last row
« Reply #1 on: April 28, 2024, 06:43:16 pm »
I solved this another way by using lazy loading and altering "totalRecords" for each batch returned.  I also passed another parameter, being my last index.

My issue is that I have results that take too long to establish how many there are, eg.I have a list of stock, I only need to list the shortages, but to go through lets say 10,000 to establish the shortages can take 5 minutes (not ideal), so I just return the number of stock as totalRecords and alter it as I know more results.

SUGGESTION: On lazy loading, the scroll bar should signify the gap afterwards as well.  There should also be a timeout before the next page is loaded as if someone wants to jump to the last row, all rows between would be loaded, instead of being left blank.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6307
    • View Profile
Re: On a sort, I need a row to always be the last row
« Reply #2 on: April 29, 2024, 03:26:22 pm »
This example shows how to exclude certain rows while sorting:

https://paramquery.com/pro/demos/freeze_rows