paging mode

Could I select the specified page number when the grid loading in paging mode?Now the grid always shows the first page number.
My current question is: I want to refresh the grid but can preserve the current page, the current page may be page 2, page 5 etc, rather than always page 1(the first page).

And I try to resolve it like below:

this.refresh = function() { var page = grid.currentPage; grid.clearAndLoad(grid.xmlFileUrl, function() { grid.changePage(page); }); }
It works, but the grid still load the page 1, then change the page to current page which is before refreshing, in other word, the grid will load twice, that is waste of time a lot.
Cound I refresh the grid and load the current page direct, without load the frist page then change to the current page?Thank you.

Just be sure that response XML doesn’t contain the “header” section with grid configuration.

If response contains only data, you can use

grid.clearAndLoad(url)

There is no need to changePage call, as grid will preserve the active page.

As for first page loading, currently this is a mandatory behavior. It is possible to customize the grid to prevent first page loading, but it requires modifications outside of a public API. If you are interested, please open a support ticket.

Thank you for you reply, unfortunately, when I call the method:

grid.clearAndLoad(grid.xmlFileUrl);

the grid is always restore the page to page 1(the first page), It will lost the current page and can not preserve the page number. I just want to preserve the current page when the grid is refreshing.

Which version of DHTMLX are you using?

Is server response for clearAndLoad command contains only data or grid’s configuration as well?

I use dhtmlx V4.03 with Java servlet.The server response is:
gridConn.render_table(“table”,“id”,“field list……”);

Are you using GridConfiguration as a part of server side code ?

No, the xml which return from server is like below, just only contains data:

<?xml version="1.0" encoding="UTF-8"?> <rows pos="1" total_count="20" > <row id="1"> <cell>1</cell> <cell>2</cell> <cell>3</cell> </row> <row id="2"> <cell>1</cell> <cell>2</cell> <cell>3</cell> </row> …… …… ohter row data </rows>
Are you sure that the grid can preserve the current page when clearAndLoad method is called on your computer?

Yep, it preserves the page in local samples. ( there are still two data call though )

If issue still occurs, please open a ticket at support.dhtmlx.com