Search code examples
sortinggwtheadercustom-headerscustomcolumn

How to make Sort Icon visible for all columns in GWT


I am creating an application where I need to do sort and search on header. I have used column.setSortable(true); and Creating sort handler. Again on other side I have created a custom header which will show textbox when clicking. I want to implement it like there will be sort icons clicking on that will sort while clicking on column label will open textbox. Can anyone suggest how I can make sort icons visible in all the columns.

Currently when I click any column sort icon gets visible on that only.


Solution

  • Done fixing this. I have used overriding onPreviewColumnSortEvent and implemented is as below

        @Override
    public boolean onPreviewColumnSortEvent( Context context, Element elem, NativeEvent event )
    {
        if ( clickableTableCell.getColumnType().equals( ColumnType.TEXTBOX ) ) {
            if ( sortFlag ) {
                sortFlag = false;
            } else {
                sortFlag = true;
            }
        }
        return sortFlag;
    }