SpreadJS supports sorting data programmatically. Filters and tables have UI sorting options. Sorting data makes it easier to find information in a column or row. You can sort data in the widget and specify a column or row index to sort on as well as the sort criteria. You can also specify multiple sort keys (sort by a specified column or row first, then another column or row, and so on). Use the sortRange method to sort data. Use the sortInfo object in the sortRange method to specify sort keys and ascending or descending order and by row or column. The row filter has a sort option that allows the user to sort the filtered data or you can use the sortColumn method. Tables also have options that allow the user to sort data as shown in the following image. Table Sorting The RangeSorting or RangeSorted event occurs when automatically sorting (with a filter or a table). This example sorts the first column in ascending or descending order. Select a button to sort. Column Sorting
You can specify multiple sort conditions when sorting. This example sorts rows using multiple sort keys.
This example uses the RangeSorted event.
This example uses the sortColumn method.