Package com.smartgwt.client.widgets.grid.events

# Interface HasSetSortHandlers

All Superinterfaces:
  `HasHandlers`

All Known Implementing Classes:
  `CalendarView`, `CubeGrid`, `DateGrid`, `EditTree`, `ListGrid`, `ListPalette`, `Menu`, `MenuPalette`, `PickListMenu`, `RecordEditor`, `SelectionTreeMenu`, `TableView`, `TreeGrid`, `TreePalette`

public interface HasSetSortHandlers extends HasHandlers

- ## Method Summary

  Modifier and Type
  Method
  Description
  `HandlerRegistration`
  `addSetSortHandler(SetSortHandler handler)`
  Optional notification fired when either user or framework code calls `setSort()`.

  ### Methods inherited from interface com.google.gwt.event.shared.HasHandlers

  `fireEvent`

- ## Method Details

  - ### addSetSortHandler

    HandlerRegistration addSetSortHandler(SetSortHandler handler)
    Optional notification fired when either user or framework code calls `setSort()`. This notification fires before the default behavior; use `event.cancel()` to cancel the default behavior. Note, the notification is fired before the default functionality, but after prechecks have completed; your method will only be called if the default behavior would have been called. For example, if there are pending edits and the user does not confirm that these should be saved, normal sorting would not have gone ahead, so equally your handler will not be called.

    The default `setSort()` method does two things to reflect the set of `sortSpecifier`s passed to it:

    - Change the grid UI (show directional arrows, numerals to indicate sort priority, etc)
    - Actually sort the grid data
    If your reason for implementing a custom `setSortHandler()` is to inhibit or replace one of those behaviors, you should cancel the default behavior and directly invoke just that part of it you require. The following implementation will replicate the default behavior:

            grid.addSetSortHandler(new SetSortHandler() {
                public void onSetSort(SetSortEvent event) {
                    displaySort(event.getSortSpecifiers());
                    applySortToData(event.getSortSpecifiers());
                    event.cancel();  // Prevent the framework from running its own default impl
                }
            });

    Parameters:
      `handler` - the setSort handler
    Returns:
      `HandlerRegistration` used to remove this handler