javascript - Sorting Slickgrid by Multiple Columns? -
i started testing out slickgrid project i'm working on , i'm impressed performance. 1 requirement have sorting on multiple columns. don't have head wrapped around dataview in slickgrid, maybe i'm missing obvious, there way sort grid on multiple columns? if ui can't handle sorting more one, able call function columns in order, plus ascending or descending. able datatables, doesn't have grouping (another requirement project).
in worst case, resort doing sorting on server , serving content client statically sorted.
you can chain sort comparers multiple column sorting. instead of doing
function compareroncol1(a, b) { return a["col1"] - b["col1"]; } function compareroncol2(a, b) { return a["col2"] - b["col2"]; }
you can do
// sort col1, col2 function combinedcomparer(a, b) { return compareroncol1(a, b) || compareroncol2(a, b); // etc. }
or implement inline.
as far reflecting sort order in ui, while can't directly, can apply sort indicators setting "headercssclass" on column definitions you're sorting , having them display arrows (or else you're indicating sort columns).
Comments
Post a Comment