Uploaded image for project: 'Click'
  1. Click
  2. CLK-640

Add DataProvider for Table and Select controls

    Details

    • Type: New Feature
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.1.0
    • Fix Version/s: 2.2.0
    • Component/s: core
    • Labels:
      None

      Description

      One reoccurring problem we see with people using Click is the inappropriate use of the Page#onRender() method. Typically its used to set data into the Table control, but then people will often use this Page method to set data in other controls such as the FormTable or Select controls, which breaks their usage contract.

      What I would like to see is that data controls such as the Table, Select and FormTable are able to load the data when they need it, rather than having to rely on the developer injecting the data at the correct point in the pages life cycle. This will provide an improve programming model where developers simply create their controls in the Page constructor or onInit() method, configure data providers when necessary, and write up control event handlers to the appropriate methods.

      The DataProvider interface would be very simple:

      public interface DataProvider

      { public List getData(); }

      Developers would then implement this interface when creating their controls:

      Table table = new Table();
      table.addColumn()
      ...
      table.setDataProvider(new DataProvider() {
      public List getData()

      { return customerDao.getCustomerList(); }

      });

      1. Table.java.patch
        7 kB
        Bob Schellink

        Activity

        Hide
        sabob Bob Schellink added a comment -

        One feature I'd like to see implemented through DataProviders is a fully pagination solution.

        The current workaround is to use a List and override its size method to return the total number of records. But this hack might bite us down the line.

        Attached is an initial patch to add a totalRows property to Table which can be used instead of rowList.size.

        Show
        sabob Bob Schellink added a comment - One feature I'd like to see implemented through DataProviders is a fully pagination solution. The current workaround is to use a List and override its size method to return the total number of records. But this hack might bite us down the line. Attached is an initial patch to add a totalRows property to Table which can be used instead of rowList.size.
        Hide
        sabob Bob Schellink added a comment -

        fixed in trunk

        Show
        sabob Bob Schellink added a comment - fixed in trunk

          People

          • Assignee:
            medgar Malcolm Edgar
            Reporter:
            medgar Malcolm Edgar
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development