OFBiz
  1. OFBiz
  2. OFBIZ-3083

Adding a page size selector in the pagination bar

    Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: SVN trunk
    • Component/s: framework
    • Labels:
      None

      Description

      I find usefull to let the user change, on the ui, the actual number of elements contained in a page.
      This can be usefull, for example, when there are 21 elements selected in a query, the user want to print them, and the page size is 20. In this case the user must print two pages.
      Having this feature, the user can select 30 as page size, and have all elements in one page.

      In the attached patch there is a first try I am working on.

      This seens to work (does not support yet ajax and i18n) but I would like to have the size selector shown even if all elements fit in one page so that the user can select a page size with less elements.

      Actually the page size selector is rendered with the prevNext bar. A solution that I was thinking on is to render the prevNext even if it would not be necessary (one page list) with all buttons disabled.

      What do you think about?

      Thank you,
      Bruno

      1. OFBIZ-3083 viewSizeSelector.patch
        10 kB
        Bruno Busco
      2. OFBIZ-3083 viewSizeSelector.patch
        9 kB
        Bruno Busco
      3. OFBIZ-3083 viewSizeSelector.patch
        9 kB
        Bruno Busco
      4. OFBIZ-3083 viewSizeSelector.patch
        5 kB
        Bruno Busco

        Activity

        Hide
        Jacques Le Roux added a comment -

        Hi Bruno,

        Sounds like an excellent idea to me. Of course having it working in all cases (ajax, i18n, etc.) would be better

        Show
        Jacques Le Roux added a comment - Hi Bruno, Sounds like an excellent idea to me. Of course having it working in all cases (ajax, i18n, etc.) would be better
        Hide
        Bruno Busco added a comment -

        Yes Jacques,
        I will add ajax and i18n but I am more interested on hearing if everybody does agree with having the pagination bar always rendered.

        Show
        Bruno Busco added a comment - Yes Jacques, I will add ajax and i18n but I am more interested on hearing if everybody does agree with having the pagination bar always rendered.
        Hide
        Jacques Le Roux added a comment -

        I'd prefer have it always rendered

        Show
        Jacques Le Roux added a comment - I'd prefer have it always rendered
        Hide
        Bruno Busco added a comment -

        Please find attached an updated patch with i18n and ajax support.

        Show
        Bruno Busco added a comment - Please find attached an updated patch with i18n and ajax support.
        Hide
        Jacques Le Roux added a comment -

        Hi Bruno,

        I just tried in categories lookup (from main Product screen).

        • From the 1st page of result, when I change from 20 (default) to 30, all dissapears.
        • From a page inside, when I change from 20 to 30, nothing happens

        I just run ant and reloaded, could be that missed something ?

        Also we may enjoy an intermediary 100 in the [20, 30, 50, 200] set. And why not bigger 500 and 1000 (10000?). They could be useful when you want to make a quick search inside a list. Of course when used these numbers should be constrained to the max items present (but I don't think we need someting more elaborated).

        Thanks

        Show
        Jacques Le Roux added a comment - Hi Bruno, I just tried in categories lookup (from main Product screen). From the 1st page of result, when I change from 20 (default) to 30, all dissapears. From a page inside, when I change from 20 to 30, nothing happens I just run ant and reloaded, could be that missed something ? Also we may enjoy an intermediary 100 in the [20, 30, 50, 200] set. And why not bigger 500 and 1000 (10000?). They could be useful when you want to make a quick search inside a list. Of course when used these numbers should be constrained to the max items present (but I don't think we need someting more elaborated). Thanks
        Hide
        Adrian Crum added a comment -

        Why not have the user enter the page size, instead of predefined page sizes?

        Show
        Adrian Crum added a comment - Why not have the user enter the page size, instead of predefined page sizes?
        Hide
        Jacques Le Roux added a comment -

        Or both, predefined is quicker

        Show
        Jacques Le Roux added a comment - Or both, predefined is quicker
        Hide
        Bruno Busco added a comment -

        Hi Jacques,
        thank you for testing the patch.
        I must say that this was a rapid prototipe I submitted in order to share ideas about it and so I did not fully tested.
        I have seen that in the lookup you tested it does not work.

        In any case it seems that in the Example list it works.
        I will look into it as soon as I have time.

        Show
        Bruno Busco added a comment - Hi Jacques, thank you for testing the patch. I must say that this was a rapid prototipe I submitted in order to share ideas about it and so I did not fully tested. I have seen that in the lookup you tested it does not work. In any case it seems that in the Example list it works. I will look into it as soon as I have time.
        Hide
        Bruno Busco added a comment -

        An updated patch with Ajax working and a "100" option added.
        Even if I did see it initially not working on the lookup It seems that it works in all cases now.

        Show
        Bruno Busco added a comment - An updated patch with Ajax working and a "100" option added. Even if I did see it initially not working on the lookup It seems that it works in all cases now.
        Hide
        Bruno Busco added a comment -

        Just to let you know that I think the patch is now OK to be reviewed and committed.
        Further improvements will be to have the availableViewSizes to be set in a configuration property file but I do not think I will do it in the short time. (any help greatly appreciated )

        Show
        Bruno Busco added a comment - Just to let you know that I think the patch is now OK to be reviewed and committed. Further improvements will be to have the availableViewSizes to be set in a configuration property file but I do not think I will do it in the short time. (any help greatly appreciated )
        Hide
        Bilgin Ibryam added a comment -

        Bruno, this is a great addition. Thanks!

        I did a quick UI test with you patch and faced these issues:

        1. When logged in to application with javascript disabled, the dropdown for page number selection is not rendered because it relies on javascrip. I think "Items per page" dropdown should not be rendered too.

        2. I did my tests in accounting->find fixed asset screen. After the seach, if your FIRST actions is changing the items per page, the selection seems not working. But after that the next selections are working fine. Then I found that this bug exists even before applying your patch, ie the first click on paginator buttons (such as next, last, changing page number) doesn;t have any effect on the UI.

        Bilgin

        Show
        Bilgin Ibryam added a comment - Bruno, this is a great addition. Thanks! I did a quick UI test with you patch and faced these issues: 1. When logged in to application with javascript disabled, the dropdown for page number selection is not rendered because it relies on javascrip. I think "Items per page" dropdown should not be rendered too. 2. I did my tests in accounting->find fixed asset screen. After the seach, if your FIRST actions is changing the items per page, the selection seems not working. But after that the next selections are working fine. Then I found that this bug exists even before applying your patch, ie the first click on paginator buttons (such as next, last, changing page number) doesn;t have any effect on the UI. Bilgin
        Hide
        Adrian Crum added a comment -

        Bilgin brings up a good point - the Find Fixed Asset screen is a good test bed for these kinds of modifications because it uses Ajax.

        Show
        Adrian Crum added a comment - Bilgin brings up a good point - the Find Fixed Asset screen is a good test bed for these kinds of modifications because it uses Ajax.
        Hide
        Bruno Busco added a comment -

        Hi Bilgin,
        thank you for reviewing the patch.

        1) I agree. I will update the patch.

        2) I did my tests about the ajax support on this page https://localhost:8443/example/control/authview/findExampleAjax
        and here you can see that the issue you found is not present.

        I have seen that the issue in the page you point out. This is due to a wrong link that appears on ALL the pagination buttons.
        For example the NEXT button has this link when the page is first loaded:

        <a href="javascript:ajaxUpdateAreas('search-results,/accounting/control/FixedAssetSearchResults,fixedAssetName_op=like&noConditionFind=Y&fixedAssetId_op=like&fixedAssetName_ic=Y&fixedAssetId_ic=Y&VIEW_SIZE_2=20&VIEW_INDEX_2=1#')">Successivo</a>

        and this link when the page is refreshed:

        <a href="javascript:ajaxUpdateAreas('search-results,/accounting/control/FixedAssetSearchResults,VIEW_INDEX_2=1&fixedAssetName_op=like&VIEW_SIZE_2=20&noConditionFind=Y&fixedAssetId_op=like&fixedAssetName_ic=Y&fixedAssetId_ic=Y&VIEW_SIZE_1=20&VIEW_INDEX_1=1#')">Successivo</a>

        As you can see there is something wrong with the VIEW_INDEX_x and VIEW_SIZE_x parameters.

        The first link only contains VIEW_INDEX_2 and VIEW_SIZE_2 (and does not work),
        the second link contains both VIEW_INDEX_1, VIEW_SIZE_1 and VIEW_INDEX_2, VIEW_SIZE_2.

        Anybody can help here?

        Show
        Bruno Busco added a comment - Hi Bilgin, thank you for reviewing the patch. 1) I agree. I will update the patch. 2) I did my tests about the ajax support on this page https://localhost:8443/example/control/authview/findExampleAjax and here you can see that the issue you found is not present. I have seen that the issue in the page you point out. This is due to a wrong link that appears on ALL the pagination buttons. For example the NEXT button has this link when the page is first loaded: <a href="javascript:ajaxUpdateAreas('search-results,/accounting/control/FixedAssetSearchResults,fixedAssetName_op=like&noConditionFind=Y&fixedAssetId_op=like&fixedAssetName_ic=Y&fixedAssetId_ic=Y&VIEW_SIZE_2=20&VIEW_INDEX_2=1#')">Successivo</a> and this link when the page is refreshed: <a href="javascript:ajaxUpdateAreas('search-results,/accounting/control/FixedAssetSearchResults,VIEW_INDEX_2=1&fixedAssetName_op=like&VIEW_SIZE_2=20&noConditionFind=Y&fixedAssetId_op=like&fixedAssetName_ic=Y&fixedAssetId_ic=Y&VIEW_SIZE_1=20&VIEW_INDEX_1=1#')">Successivo</a> As you can see there is something wrong with the VIEW_INDEX_x and VIEW_SIZE_x parameters. The first link only contains VIEW_INDEX_2 and VIEW_SIZE_2 (and does not work), the second link contains both VIEW_INDEX_1, VIEW_SIZE_1 and VIEW_INDEX_2, VIEW_SIZE_2. Anybody can help here?
        Hide
        Bruno Busco added a comment -

        Please find attached an updated patch that solves what Bilgin has pointed out as #1.
        Additionally I changed the template to show the "Displaying x-y out of z" string even if the javascript is disabled.

        Show
        Bruno Busco added a comment - Please find attached an updated patch that solves what Bilgin has pointed out as #1. Additionally I changed the template to show the "Displaying x-y out of z" string even if the javascript is disabled.
        Hide
        Jacques Le Roux added a comment -

        It works well in lookups now, I wonder though, as suggested Adrian, if we should not allow the user to enter the size her/he wants ?

        Show
        Jacques Le Roux added a comment - It works well in lookups now, I wonder though, as suggested Adrian, if we should not allow the user to enter the size her/he wants ?
        Hide
        Bruno Busco added a comment -

        I think this could be a further improvement implemented at a later time.

        Show
        Bruno Busco added a comment - I think this could be a further improvement implemented at a later time.
        Hide
        Jacques Le Roux added a comment -

        I agree, we should open a new Jira for the point 2.

        Show
        Jacques Le Roux added a comment - I agree, we should open a new Jira for the point 2.
        Hide
        Bruno Busco added a comment -

        I have reopened OFBIZ-1935 since this issue already deals with this kind of issue.

        Do you think the patch can be committed now?

        Show
        Bruno Busco added a comment - I have reopened OFBIZ-1935 since this issue already deals with this kind of issue. Do you think the patch can be committed now?
        Hide
        Bilgin Ibryam added a comment -

        Thanks Bruno. Your patch is committed to trunk in r831676

        Show
        Bilgin Ibryam added a comment - Thanks Bruno. Your patch is committed to trunk in r831676

          People

          • Assignee:
            Bilgin Ibryam
            Reporter:
            Bruno Busco
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development