Custom paging with array of JavaScript objects

Custom paging with array of JavaScript objects

ShkelzenShkelzen Posts: 1Questions: 1Answers: 0
edited May 2015 in Free community support

I am working on a application which is nicely modularized using requirejs. One of the modules called data service is in charge of providing other modules with data. Pretty much all get* methods of this module return javascript script objects in the the following format:

res = {
    totalRows: 537, 
    pageSize: 10, 
    page: 15, 
    rows: [
        {
            id: 1, 
            name: 'John'
            ...
        }, 
        {
            id: 2, 
            name: 'Michael'
            ...
        }, 
        {
            id: 3, 
            name: 'Stephen'
            ...
        }, 
        {
            id: 4, 
            name: 'Dan'
            ...
        }, 
        {
            id: 5, 
            name: 'Rob'
            ...
        },
                ....
    ]
}

Is it possible to initialize the data table so that it "knows" that we are currently viewing page #15 of total 54 pages and that consequently it builds the pager correctly to allow the user to view other pages.

Thanks in advance!

Zen

This discussion has been closed.