KoGrid icon indicating copy to clipboard operation
KoGrid copied to clipboard

Pagination issue in examples

Open a3code opened this issue 12 years ago • 1 comments

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 ?

a3code avatar Mar 26 '13 16:03 a3code

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.

bhushanvinay avatar Jul 27 '13 22:07 bhushanvinay