Change cell value without breaking the sort order of another column

Hi. I’ve tried to implement sorting both via the ColumnSorting plugin and by manually sorting the physical rows . Both ways I can get to work, but in both cases a sorted column is reset if I change the value in another cell programmatically; either by using setDataAtCell or manipulating each physical row. I would like to avoid the reset of the sorting. How - if possible - can that be achieved? Thanks in advance.

Hi @bgha
Can you share more details about this case?

I made a demo when on a bt click we set change value in 1,1 cell.
When we sort a column and click the bt to change cell’s content sorting is not erased.

Hi again. Thanks for your quick response. I’m using the ng-handsontable and in my case it doesn’t behave as in your fiddle, so I guess the problem is caused by something in the Angular lifecycle (or my misconfiguration of the Angular view model). Another question; is it possible to call setDataAtCell without causing an afterChange listener to be fired? Or will I have to temporarily have the hook removed and add it again afterwards (or somehow use a flag that tells the afterChange listener not to do what it normally does). Best Regards, bgha

Hi @bgha
it will be fired but if you’re trying to perform a specific action maybe you should try to limit this actions to a source of changes?

HI again. I finally found the issue and thought I would share it with you. When you do a sort, it is important that you do NOT modify any of the columns (fx in a beforeColumnSort listener). If you do, a subsequent call to setDataAtCell, will result in the sorting being reset. I guess the handsontable instance is observing the columns. Anyway the Chrome inspector shows a warning about Object.observe being deprecated. Best regards, bgha.

Thank you @bgha
About the Object.observe it’s already mentioned here but thanks for sharing.

Could you share a demo where this behavior can be replicable, it sounds complicated at the first glance but also sounds like a bug - that sooner or later should be fixed.

I assume that if there where to reply for more than 2 weeks we can close this issue. If this bug is still present please create new issue.