In knockout I wish to change/ refresh Paging when data is changed. For example: I have a data set of 100[5 Records per Page] and I am on Page 10. Now with some more search Data is changed from 100 to 5 and I am on Page 10, but when data is changed I want paging to be on First page. i.e Paging to be refreshed.
Here is my [Fiddle] (https://jsfiddle.net/975ncawv/281/)
MyVM.prototype.loadData = function(rawData) {
this.items(rawData.map(RowModel.fromRawDataPoint));
};
ko.applyBindings(new MyVM(myData));
Two things need to be changed inside the
loadData
function.all
observableArray needs to be updated with the new values ofitems
, since it gets the values in a similar fashion in line 65.pageNumber
needs to be reset to 0, sincepaginated
andall
are listening to it through the computed function. (And the table is displaying the values ofpaginated
).It would look like this updated fiddle.