Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Event Handler in the Menu "Sort Ascending" and "Sort Descending" in the ListGrid

    Is there an event handler exists when the user press the text Sort Ascending or Sort Descending in the listgrid?

    There are a addHeaderClickHandler for the header but not for the menu Sort ascending and descending sort ...

    Thanks

    #2
    Same question here:
    Is there a way to get sorting events independent of whether they came form a header click, a context menu click, or some API calls?

    Plus I noticed something unexpected in SmartGWT 2.2.
    When I set a HeaderClickHandler to detect sorting changes, getSortField () always returns the name of the "previous" column, and not the one that just got clicked. To get the column clicked I need to do the "getField (getEventColumn ()).getName ()" trick:
    Code:
    addHeaderClickHandler (new HeaderClickHandler  () {
            public void onHeaderClick (final HeaderClickEvent event) {
              
              logger.debug ("onHeaderClick (): sortField    : " + getSortField ());
              logger.debug ("onHeaderClick (): sortDirection: " + getSortDirection ().name ());
              logger.debug ("onHeaderClick (): sortState    : " + getSortState ());
              final SortSpecifier[] sortSpecifierArray = getSort ();
              int count = 0;
              for (final SortSpecifier sortSpecifier : sortSpecifierArray) {
                count ++;
                logger.debug ("onHeaderClick (): sortSpecifier[" + count + "]: " + sortSpecifier.getField ());
                logger.debug ("onHeaderClick (): sortDirection[" + count + "]: " + sortSpecifier.getSortDirection ());
              }
              logger.debug ("onHeaderClick (): getEventColumn: " + getEventColumn () + " --> " + getField (getEventColumn ()).getName ());
            }

    Comment

    Working...
    X