Tapestry
  1. Tapestry
  2. TAPESTRY-958

Table column headers with a custom render block cannot be sorted

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 4.0.2
    • Fix Version/s: 4.1.2
    • Component/s: Contrib
    • Labels:
      None

      Description

      With contrib:Table, a custom Block can be used to render a table column header (in my case, I'd like to render an Image in the header instead of the column name). However, the link in the header to sort the column is not rendered anymore when a custom block is used for the column header. This makes the column effectively unsortable, which I would not expect to be desired behavior...

      I guess this can simply be fixed in SimpleTableColumnComponent by rendering the supplied custom Block inside a copy of the "linkColumn" component, so clicking somewhere on content in the custom supplied block (in my case: an image) also sorts the column.

        Activity

        Mark Thomas made changes -
        Workflow Default workflow, editable Closed status [ 12568027 ] jira [ 12591135 ]
        Mark Thomas made changes -
        Workflow jira [ 12372261 ] Default workflow, editable Closed status [ 12568027 ]
        Andreas Andreou made changes -
        Resolution Fixed [ 1 ]
        Status In Progress [ 3 ] Resolved [ 5 ]
        Hide
        Andreas Andreou added a comment -

        Use @contrib:ColumnSortLink and @contrib:ColumnSortImage

        Show
        Andreas Andreou added a comment - Use @contrib:ColumnSortLink and @contrib:ColumnSortImage
        Andreas Andreou made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        Andreas Andreou made changes -
        Assignee Andreas Andreou [ andyhot ]
        Jesse Kuhnert made changes -
        Field Original Value New Value
        Fix Version/s 4.1.2 [ 12312202 ]
        Hide
        Andreas Andreou added a comment -

        On the other hand, it might actually be useful for the contrib library to provide these two components...
        Then one could do:
        <table jwcid="contrib:Table" ...>
        <span jwcid="idColumnHeader@Block">
        Add html for the header... <a jwcid="@contrib:ColumnSortLink"><img jwcid="@contrib:ColumnSortImage"/></a>
        </span>
        </table>

        So, i'm leaving this open - I think it's a nice idea & we can go ahead with this.

        Show
        Andreas Andreou added a comment - On the other hand, it might actually be useful for the contrib library to provide these two components... Then one could do: <table jwcid="contrib:Table" ...> <span jwcid="idColumnHeader@Block"> Add html for the header... <a jwcid="@contrib:ColumnSortLink"><img jwcid="@contrib:ColumnSortImage"/></a> </span> </table> So, i'm leaving this open - I think it's a nice idea & we can go ahead with this.
        Hide
        Mind Bridge added a comment -

        I would also suggest to define the link yourself in the template and to tie the link to a method that does the following:

        ITableSortingState sortingState = tableModel.getSortingState();
        if (columnName.equals(sortingState.getSortColumn()))
        sortingState.setSortColumn(columnName, !sortingState.getSortOrder());
        else sortingState.setSortColumn(columnName, ITableSortingState.SORT_ASCENDING);

        This will duplicate the functionality of the standard column implementation.

        Show
        Mind Bridge added a comment - I would also suggest to define the link yourself in the template and to tie the link to a method that does the following: ITableSortingState sortingState = tableModel.getSortingState(); if (columnName.equals(sortingState.getSortColumn())) sortingState.setSortColumn(columnName, !sortingState.getSortOrder()); else sortingState.setSortColumn(columnName, ITableSortingState.SORT_ASCENDING); This will duplicate the functionality of the standard column implementation.
        Hide
        Andreas Andreou added a comment -

        Yes, but this wouldn't allow complete control of the table column header, would it?
        Taking a look at the .java, .jwc, .html of SimpleTableColumnComponent
        I would prefer to create my own ColumnSortLink and ColumnSortImage
        components, and use those in my custom Blocks.

        Show
        Andreas Andreou added a comment - Yes, but this wouldn't allow complete control of the table column header, would it? Taking a look at the .java, .jwc, .html of SimpleTableColumnComponent I would prefer to create my own ColumnSortLink and ColumnSortImage components, and use those in my custom Blocks.
        Mathijs den Burger created issue -

          People

          • Assignee:
            Andreas Andreou
            Reporter:
            Mathijs den Burger
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development