Pagination module

I’m working with xgrid and there is a good use of pagination module.



Then there is some questions and problems arise:



1) While we can setup some of pagination parameters, there still some, that ain’t accessible for setup, like “page divider” or custom string to show page number or news number.

2) It got an arrow to move to the next group of pages, but it doesn’t have those which will move to first and last entry

3) When using method grid.updateFromXML pagination display ain’t working correctly, it display only 1 page per page group so other pages only accessible by clicking arrow “>”. If used grid.ClearAll, grid.LoadXML it works just find, but with visible shrinking of table, that doesn’t looks nice. Is this a bug or just mine misunderstanding of pagination settings?



Thank you.

>> like “page divider” or custom string to show page number or news number.


divider can be set as
    grid.pagesDevider="  some  "

basically you can check and modify dhtmlxgrid_pgn.js createPagingBlock method - it contains code which builds HTML for paging view

>>2) It got an arrow to move to the next group of pages, but it doesn’t have those which will move to first and last entry

In case of paging-with-toolbar - grid render more complex GUI , with additional buttons.
Actually you can use any custom button and grid’s API
    grid.changePage(1) - first page
    grid.changePage(grid.totalPages); - last page


>>When using method grid.updateFromXML pagination display ain’t working correctly
Please contact us directly at support@dhtmlx.com - we will provide updated version of dhtmlxgrid_pgn.js, which must resolve issue.

>> like “page divider” or custom string to show page number or news number.

>>divider can be set as
>>grid.pagesDevider="  some  "
>>basically
you can check and modify dhtmlxgrid_pgn.js createPagingBlock method -
it contains code which builds HTML for paging view
Actually I’m already did so, but I’d like to use original functionality, to keep it up to date without worries of my custom code in there.

>>>>2) It got an arrow to move to the next group of pages, but it doesn’t have those which will move to first and last entry

>>In case of paging-with-toolbar - grid render more complex GUI , with additional buttons.
>>Actually you can use any custom button and grid’s API
>>    grid.changePage(1) - first page
>>    grid.changePage(grid.totalPages); - last page
There is a bit more calculation required, since we shouldn’t display “go to first page” button, when we at the page group, where first page is displayed already(not only on first page) same goes for last page button.
So now I do math to check is current page in first page group/last page group or in the middle.
Thats why i’m really like to see release that implement this feature )

Thats why i’m really like to see release that implement this feature )
In case of using paging-with-toolbar - such functionality already exists, the original paging uses pretty simple view, because it may be different for different use-cases , and it pretty hard to create universal solution, which will be useful in all situations.

>>So now I do math to check is current page in first page group/last page group or in the middle.

if (grid.currentPage == 1 ) alert(“we on first page”);
if (grid.currentPage == grid.totalPages ) alert(“we on last page”);

Yes, I saw paging toolbar, but it won’t fit many designs, so its a bit useless in such cases.

>>>>So now I do math to check is current page in first page group/last page group or in the middle.
>>if (grid.currentPage == 1 ) alert(“we on first page”);
>>if (grid.currentPage == grid.totalPages ) alert(“we on last page”);
I think u don’t quite get the point of a problem, let me draw it:

We on the first page, we should show “>>” to get to the last page, but hide “<<” to get to the first page, since we already there.
=============
1 | 2 | 3 | 4 | > | >>
=============
We on the third page, its not the first page, but its in the first page group, so “<<” still should be hidden.
=============

1 | 2 | 3 | 4 | > | >>

=============
We in the middle-group-page, both arrows shown

===================
<< | < | 5 | 6 | 7 | 8 | > | >>

===================

We on the last page group but not at the last page and this page group got shortened, since there is not enough page to fill page group. “>>” arrows hidden.

==============

<< | < | 5 | 6 | 7

==============
You have already done this math in your own module, since you know when to hide " > " and "  < " arrows and its working )

Actually this functionality design are pretty common and while paging toolbar provides quite more then simplifized version, its quite hard to insert it in already existing page design, so most developers will be bound to use simplifized version or even just information from module to be able to draw their own design with using just this module’s functionality.

I hope, my point is pretty clear now )

In the very end its sums up to the following:
1. Module should be able to draw page group (already implemented)
1.1 Pages in the page group should be represented by page number or by the first record number on the page.(not implemented now)
2. Module should have api to recognize when first/last page are shown in the paging block. (not implemented now)
3. Module should have api to jump to desired page (already implemented)
3.1 Module shold have api to jump to desired page group and next/prev page group (its already done inside, but we don’t have api to control it)
4… etc )

At this point I think I’m requesting too much, actually i’d be happy if there “to first page” and “to last page” controls will be implemented in some future releases.

Thanks  )

>>we should show “>>” to get to the last page, but hide “<<”

grid provide “onPageChanged” event which allows to made any dynamic updates

grid.attachEvent(“onPageChanged”,function(current ){
    show_last_button();
    show_first_button();
    if (current == 1)
       hide_first_button();
    if (current == grid.totalPages )
       hide_last_button();

    return true;
});

Also, the “paging-with-toolbar” already implemented such behavior.

>>In the very end its sums up to the following:

We plan some improvements in paging module, we will try to include provided requirements as well.

Okay, thank you for your answers regarding other issues/feature requests.
Everything more or less clear now )
I’ll look forward for feature releases.