KoGrid
KoGrid copied to clipboard
Pagination issue in examples
I have found on issue with largeData example, It looks like pagination in this case dos't work correct code in main.js:
self.getPagedDataAsync = function (pageSize, page, searchText) {
setTimeout(function () {
var data;
if (searchText) {
var ft = searchText.toLowerCase();
data = largeLoad().filter(function (item) {
return JSON.stringify(item).toLowerCase().indexOf(ft) != -1;
});
} else {
data = largeLoad();
}
//var pagedData = data.slice((page - 1) * pageSize, page * pageSize);
self.myData(data);
self.pagingOptions.totalServerItems(data.length);
}, 100);
};
show all data in grid not first. How to use pagination in correct way ?
Look at in debug, you may have that the page options are not set, i.e., you page size and no of pages are not set. Initially had the same problem, but then subscribed to the MyData.subscribe(call the getPagedDataAsync) that way once the MyData notifies a change we can subscribe to the change and fire the event on it.
May be not so elegant but it works.