Getting current page number & items per page in grid paginat

Hi,
I am using the pagination style ‘toolbar’ in my grid component.
User can change the items per page & curent page number to traverse the data.
Is there any API to get ‘Current page number’ & ‘items per page’ values?
I want that whenever user refreshes the page, he/she is taken back to his opened page along with the ‘items per page’ value also honored.

In my scenario, i am reloading the jsp page by passing all the arguments to the page url. So, that i can read those parameters & set those values in the user’s new view. So, i need to get these parameters before i invoke the reload API.

Regards,
Vibhav Agrawal

You can use

grid.rowsBufferOutSize //count of rows per page grid.currentPage //current page number

Hi,

I could get the current page number & ‘rows per page’ values.
And after loading the data back, i could set the current page by changePage().
But could not find any API by which i can change the ‘rows per page’ value.

Is there any API by which i can set this value resulting in the change of the grid layout? I think i am missing the API method.

Regards,
Vibhav Agrawal

You can set it directly as

grid.rowsBufferOutSize = some_value; grid.changePage(some_page);

Hi,
I’m using dhtmlxGrid’s clearAll() api. It is clearing table data but not the filter fields. So is there any way that I can apply filter after reloading the table data??
Same with the sorting. After reloading the data in grid the sorting symbol on column header is restored or saved but sorting is not applied on the data. Is there any solution for this??

Hi,

Whenever i use the grid.clearAll() & loadXML OR clearAndLoad() apis, the data loaded after this is not filtered based on the filters previously applied.

The filters are shown in the grid as applied (the values of filter remain same after the load of data also).

So, i tried to filter that data in my onXLE event. For that, I tried using filterByAll() OR refreshFilters(), but its not filtering the data back. So, i tried to get the filter information for the table before calling clearAll(). but i could not find any API which gives all filters’ information.

So, culd you please let me know the correct expected behaviour for this clear & reload operations, that:

  1. is it a bug with dhtmlx code & filters should be already applied in the data after reload?
  2. If not so, then why are the filter state is not getting cleared?
  3. If its expected behaviour, then how can we reapply the filter to the data loaded?

Regards,
Vibhav agrawal

Vibhav I had the exact same situation. This is my first post and after see you have this issue I’m hoping someone could help. I am applying updates to data and want my filters to be reapplied after the data is updated and refreshed. I thought there would be a reapply filters or at worst case I could iterate all my filters reapplying them but I can’t find any functionality in the api to iterate the filters(I have text filters).

Its surprising that my error and way of solving was exactly the same.

If filters are still in place, you can call
grid.filterByAll();
after data reloading, to reapply filters.

but i could not find any API which gives all filters’ information.
You can use grid.getFilterElement(index).value to access value of filter, or define beforeFilter event handler , and save data to some var, each time when filtering is occurs.

  1. is it a bug with dhtmlx code & filters should be already applied in the data after reload?
    Filters will not be applied automatically, but call of filterByAll must reapply them. ( assuming that you are reloading only data, not the structure of a grid )