Uploaded image for project: 'OpenOLAT'
  1. OpenOLAT
  2. OO-2087

FlexiTables: Enabling other default page sizes than 20

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed (View Workflow)
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 10.5.2
    • Fix Version/s: 10.5.3
    • Component/s: Framework
    • Labels:
      None

      Description

      When instantiating a FlexiTableElement an individual pagesize can be defined. The rendering of the page links ignores a different default page size than 20 because 20 is hard coded. The following patch adds more flexibility by including an individual default page size.

      diff --git a/src/main/java/org/olat/core/gui/components/form/flexible/impl/elements/table/AbstractFlexiTableRenderer.java b/src/main/java/org/olat/core/gui/components/form/flexible/impl/elements/table/AbstractFlexiTableRenderer.java
      --- a/src/main/java/org/olat/core/gui/components/form/flexible/impl/elements/table/AbstractFlexiTableRenderer.java
      +++ b/src/main/java/org/olat/core/gui/components/form/flexible/impl/elements/table/AbstractFlexiTableRenderer.java
      @@ -19,6 +19,7 @@
        */
       package org.olat.core.gui.components.form.flexible.impl.elements.table;
       
      +import java.util.Arrays;
       import java.util.List;
       
       import org.olat.core.gui.components.Component;
      @@ -370,7 +371,7 @@
       		FlexiTableDataModel<?> dataModel = ftE.getTableDataModel();
       		int rows = dataModel.getRowCount();
       
      -		if (rows > 20) {
      +		if (rows > ftE.getDefaultPageSize()) {
       			renderPageSize(sb, ftC, translator);
       		}
       
      @@ -418,6 +419,11 @@
       	      .append("<ul class='dropdown-menu' role='menu'>");
       		
       		int[] sizes = new int[]{ 20, 50, 100, 250 };
      +		int defaultPageSize = ftE.getDefaultPageSize();
      +		if (Arrays.binarySearch(sizes, defaultPageSize) < 0) {
      +			sizes = new int[]{ 20, 50, 100, 250, defaultPageSize };
      +			Arrays.sort(sizes);
      +		}
       		for(int size:sizes) {
       			sb.append("<li><a href=\"javascript:")
       			  .append(FormJSHelper.getXHRFnCallFor(theForm, dispatchId, 1, true, true,
      

        Attachments

          Activity

            People

            Assignee:
            srosse Stéphane Rossé
            Reporter:
            stephan Stephan Clemenz
            Tester:
            Stephan Clemenz
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 20 minutes
                20m