Page 1 of 1

[N/A] AJAX grid and returning the current page

Posted: Fri May 28, 2021 1:52 am
by gregc

I'm not sure if my design is correct, but when I want to find a specific value/row and open the grid I currently do all the work on the backend to find it in the dataset and figure out which page it is on.

I then return my html, my grid and just the data for the page it is on.
However the grid displays page 1. Is there a way to return the page number so that the grid displays that?


Re: AJAX grid and returning the current page

Posted: Fri May 28, 2021 9:55 am
by saki

For paging to work as expected you shouldn't return any html from the server but only data. The easiest way to see what is expected is to use https://bryntum.com/examples/grid/paged/ demo (locally) and to put the following in the code (app.js):

    console.log(params, {
        success : true,
        total   : returnedData.length,
        data    : returnedData.slice(startIdx, startIdx + pageSize)
    });

just before the return statement of AjaxHelper.mockUrl('/pagedMockUrl', (url, params) => { call.

Then, when you run the example, you can see in the console:

Screen Shot 2021-05-28 at 09.52.40.png
Screen Shot 2021-05-28 at 09.52.40.png (53.31 KiB) Viewed 632 times

Server receives the request page number and pageSize and is expected to return the data of that page and total count of records plus the success flag.


Re: [N/A] AJAX grid and returning the current page

Posted: Fri May 28, 2021 2:12 pm
by gregc

Thanks, I have to think about this a little more, my design for jumping to a page is a little off.