Search in sources :

Example 1 with QuickTip

use of com.extjs.gxt.ui.client.widget.tips.QuickTip in project activityinfo by bedatadriven.

the class FlatSiteGridPanel method initGrid.

public void initGrid(Filter filter, ColumnModel columnModel) {
    PagingLoader<PagingLoadResult<SiteDTO>> loader = new BasePagingLoader<PagingLoadResult<SiteDTO>>(new SiteProxy());
    loader.addLoadListener(new LoadListener() {

        @Override
        public void loaderLoadException(LoadEvent le) {
            Log.debug("Exception thrown during load of FlatSiteGrid: ", le.exception);
        }
    });
    loader.setRemoteSort(true);
    loader.setSortField("date2");
    loader.setSortDir(SortDir.DESC);
    pagingToolBar.bind(loader);
    listStore = new ListStore<>(loader);
    if (editorGrid == null) {
        editorGrid = new EditorGrid<SiteDTO>(listStore, columnModel);
        editorGrid.setLoadMask(true);
        // editorGrid.setStateful(true);
        editorGrid.setClicksToEdit(ClicksToEdit.TWO);
        editorGrid.setStripeRows(true);
        final GridSelectionModel<SiteDTO> sm = new GridSelectionModel<SiteDTO>();
        sm.setSelectionMode(SelectionMode.SINGLE);
        sm.addSelectionChangedListener(new SelectionChangedListener<SiteDTO>() {

            @Override
            public void selectionChanged(SelectionChangedEvent<SiteDTO> se) {
                fireEvent(Events.SelectionChange, se);
            }
        });
        editorGrid.setSelectionModel(sm);
        new QuickTip(editorGrid);
        editorGrid.addListener(Events.RowDoubleClick, new Listener<GridEvent>() {

            @Override
            public void handleEvent(GridEvent be) {
                SiteDTO site = listStore.getAt(be.getRowIndex());
                SelectionChangedEvent<SiteDTO> event = new SelectionChangedEvent<>(sm, site);
                fireEvent(Events.RowDoubleClick, event);
            }
        });
        add(editorGrid, new BorderLayoutData(Style.LayoutRegion.CENTER));
        layout();
    } else {
        editorGrid.reconfigure(listStore, columnModel);
    }
    this.currentFilter = filter;
    loader.load();
    new QuickTip(editorGrid);
}
Also used : QuickTip(com.extjs.gxt.ui.client.widget.tips.QuickTip) BorderLayoutData(com.extjs.gxt.ui.client.widget.layout.BorderLayoutData) GridSelectionModel(com.extjs.gxt.ui.client.widget.grid.GridSelectionModel) SiteDTO(org.activityinfo.legacy.shared.model.SiteDTO)

Aggregations

GridSelectionModel (com.extjs.gxt.ui.client.widget.grid.GridSelectionModel)1 BorderLayoutData (com.extjs.gxt.ui.client.widget.layout.BorderLayoutData)1 QuickTip (com.extjs.gxt.ui.client.widget.tips.QuickTip)1 SiteDTO (org.activityinfo.legacy.shared.model.SiteDTO)1