Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-5181

Add a page size chooser to livetables

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.3, 2.2.6
    • Fix Version/s: 2.4 M1
    • Labels:
      None
    • Difficulty:
      Unknown
    • Similar issues:

      Description

      Currently the number of rows displayed in a livetable is fixed at creation time.

      I propose to add an UI controls (currently select) that allows to change the pagination size freely.

      This patch is both a change in livetable.js to support these controls (one or more), and a change in the livetable macro to allow displaying them.

      #livetable macro changes improvements

      The #livetable macro default to display a pageSize control. It a select control placed where the ajax-loader bar is located. It is hidden during loading, so that it swaps with the ajax-loader bar. The control is prefixed by a label "per page of". (see screenshots below)

      You can disable this new feature by setting options.pageSize to false.

      A new options.pageSizeBounds, that should be a valid code to initialize an array of 3 numbers (not sure this is the best option, you may have your own ideas). If this options is present, the necessary markup is added to the table.

      Livetable.js improvements

      The added feature work similarly to the pagination feature. It defaults to add its controls in nodes styled ".xwiki-livetable-pagesize-content" under nodes styled ".xwiki-livetable-pagesize" which can be customized with options.pageSizeNodes.

      The added controls are select nodes styled ".pagesizeselect". These select nodes contains options from options.pageSizeBounds[0] (defaults to 10) to options.pageSizeBounds[1] (default to 100), by step of options.pageSizeBounds[2] (default to 10). If the current size is not in these options, it is also inserted properly between the correct steps.

      When an options is selected by the user, the livetable cache is cleared, and the user returned to the first page with the new pagination in place (this could be improved, not so easy however, I am investigating).

      Colateral improvements

      To support hiding the control during loading, I had to add a loadingComplete custom even on the livetable. My feeling is that is was missing, since it was impossible to pair the loadingEntries events in case of failure. I have also adapted the livetable stylesheet for proper display and also improve the display when no pagesize select is used.

        Attachments

          Activity

            People

            Assignee:
            softec Denis Gervalle
            Reporter:
            softec Denis Gervalle
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: