public interface HasSetSortHandlers
extends com.google.gwt.event.shared.HasHandlers | Modifier and Type | Method and Description |
|---|---|
com.google.gwt.event.shared.HandlerRegistration | addSetSortHandler(SetSortHandler handler) Optional notification fired when either user or framework code calls setSort(). |
com.google.gwt.event.shared.HandlerRegistration addSetSortHandler(SetSortHandler handler)
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 sortSpecifiers passed to it:
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
}
});handler - the setSort handlerHandlerRegistration used to remove this handler