angular-data-table
angular-data-table copied to clipboard
Row are not re-sorted when data change
I there are some new data bound to the rows property, then table keeps its current sorting marks, but the new data are not re-sorted. I've been able to fix this with a trivial patch, but I'm not sure if I'm not missing something. I just removed the watch()
call to keep the watch even after constructor ran. What I changed:
javascript
// default sort
var watch = $scope.$watch('dt.rows', (newVal) => {
if(newVal){
// just commented this out
//watch();
this.onSorted();
}
});
Thats kind a pricey fix :S ... can u make a demo ( plunkr/fiddle/etc ) showing the issue and the fix?
I know that it's performance hit. Would it be enough for you to just take a look here? https://melite2-dev.herokuapp.com/#/people/me/profile/documents/Application try to sort a column, and then change a section. The sort icon will stay, data will update, but it will no longer be sorted by the specified orded.
~~Now I narrowed it down. This problem does NOT happen when sortType: 'single'
.~~ False alarm, still broken even with 'single'.
Less pricey fix would be to allow somehow to tell the data-table directive to resort itself. It could listen to $broadcast
or something.. actually isn't there some way to force resort even with existing version?
In my use case, I splice all my data out of the table and re-insert it sorted. My use case uses server-side sorting though.
Any updates @tomaash