esvit / ng-table

Simple table with sorting and filtering on AngularJS
http://esvit.github.io/ng-table
BSD 3-Clause "New" or "Revised" License
2.77k stars 851 forks source link

ng-table watchs isDataReloadRequired() erroneously #1033

Open zipper01 opened 6 years ago

zipper01 commented 6 years ago

In ngTableController.ts subscribeToTableEvents(): this.$scope.$watch('params.isDataReloadRequired()', (newStatus: boolean/*, oldStatus*/) => { this.onDataReloadStatusChange(newStatus); });

In ngTableParams.ts: isDataReloadRequired() { // note: using != as want to treat null and undefined the same return !this.isCommittedDataset || !ng1.equals(this.createComparableParams(), this.prevParamsMemento) || this.hasGlobalSearchFieldChanges(); }

This means if isDataReloadRequired() returns true in the last digest and returns true again in THIS digest, the this.onDataReloadStatusChange(newStatus) will not be called and contents will not be refreshed because the watched value is not changed.