Search in sources :

Example 1 with PagingLoadConfig

use of com.extjs.gxt.ui.client.data.PagingLoadConfig in project activityinfo by bedatadriven.

the class AbstractGridPresenter method firePageEvent.

protected void firePageEvent(AbstractGridPageState place, LoadEvent le) {
    Object config = le.getConfig();
    if (config instanceof ListLoadConfig) {
        place.setSortInfo(((ListLoadConfig) config).getSortInfo());
    }
    if (config instanceof PagingLoadConfig && place instanceof AbstractPagingGridPageState) {
        int offset = ((PagingLoadConfig) config).getOffset();
        ((AbstractPagingGridPageState) place).setPageNum(pageFromOffset(offset));
    }
    eventBus.fireEvent(new NavigationEvent(NavigationHandler.NAVIGATION_AGREED, place));
}
Also used : NavigationEvent(org.activityinfo.client.event.NavigationEvent) ListLoadConfig(com.extjs.gxt.ui.client.data.ListLoadConfig) PagingLoadConfig(com.extjs.gxt.ui.client.data.PagingLoadConfig)

Example 2 with PagingLoadConfig

use of com.extjs.gxt.ui.client.data.PagingLoadConfig in project activityinfo by bedatadriven.

the class AbstractGridPresenter method onLoaded.

protected void onLoaded(LoadEvent le) {
    Map<String, Object> stateMap = new HashMap<String, Object>();
    Object config = le.getConfig();
    if (config instanceof ListLoadConfig) {
        SortInfo si = ((ListLoadConfig) config).getSortInfo();
        stateMap.put("sortField", si.getSortField());
        stateMap.put("sortDir", si.getSortDir() == Style.SortDir.ASC ? "ASC" : "DESC");
    }
    if (config instanceof PagingLoadConfig) {
        int offset = ((PagingLoadConfig) config).getOffset();
        stateMap.put("offset", offset);
    }
    saveState(stateMap);
}
Also used : HashMap(java.util.HashMap) ListLoadConfig(com.extjs.gxt.ui.client.data.ListLoadConfig) PagingLoadConfig(com.extjs.gxt.ui.client.data.PagingLoadConfig) SortInfo(com.extjs.gxt.ui.client.data.SortInfo)

Aggregations

ListLoadConfig (com.extjs.gxt.ui.client.data.ListLoadConfig)2 PagingLoadConfig (com.extjs.gxt.ui.client.data.PagingLoadConfig)2 SortInfo (com.extjs.gxt.ui.client.data.SortInfo)1 HashMap (java.util.HashMap)1 NavigationEvent (org.activityinfo.client.event.NavigationEvent)1