jrowen / rhandsontable

A htmlwidgets implementation of Handsontable.js
http://jrowen.github.io/rhandsontable/
Other
384 stars 148 forks source link

Determine if sorting is enabled and get index of the column by which the table is sorted #241

Open CharlesBordet opened 6 years ago

CharlesBordet commented 6 years ago

Hi,

I have noticed that when the user sort a rhandsontable, it doesn't update the data. It is explained in the documentation (http://jrowen.github.io/rhandsontable/#sorting), stating that "sorting only impacts the widget and will not reorder the original data set".

But I have filter widgets so that the user can filter the table. In this case, I would like the table to keep its ordering. But since the ordering only impacts the dataset, I can't detect how the table was sorted to replicate it after filtering. So, after filtering, the table returns to its original ordering.

Ideally, I would know the column by which the table was sorted, then I filter the data, sort it accordingly, and display it as the user would expect.

This seems possible with handsontable, according to the documentation (see https://docs.handsontable.com/0.38.1/demo-sorting.html, section "How to determine if sorting is enabled"), with the sortColumn method. But this doesn't seem implemented in rhandsontable.

Would it be possible to see it implemented at some point?

Thanks.

jrowen commented 5 years ago

This should be possible. Pull requests are always welcome.