var contacts = new ContactsModel(); var users = new UsersModel(); var view = new GridView({model: contacts, users: users})
protected void ensureVisible(CellEditor editor) { if (isVisible()) { grid.getView().ensureVisible(this.rowIndex, indexOf(editor), true); } }
@Override protected void initTemplates() { super.initTemplates(); GridSelectionModel<ModelData> sm = grid.getSelectionModel(); sm.addListener(Events.BeforeSelect, new Listener<SelectionEvent<ModelData>>() { public void handleEvent(SelectionEvent<ModelData> be) { onBeforeRowSelect(be); } }); }
/** * Returns the column's alignment. * * @param colIndex the column index * @return the alignment */ public HorizontalAlignment getColumnAlignment(int colIndex) { ColumnConfig c = getColumn(colIndex); return c != null ? c.getAlignment() : null; }
/** * Sets the dataIndex for a column. * * @param colIndex the column index * @param dataIndex the data index */ public void setDataIndex(int colIndex, String dataIndex) { ColumnConfig c = getColumn(colIndex); if (c != null) { c.setDataIndex(dataIndex); } }
/** * Returns the cell renderer. * * @param colIndex the column index * @return the cell renderer */ public GridCellRenderer<ModelData> getRenderer(int colIndex) { ColumnConfig c = getColumn(colIndex); return c != null ? c.getRenderer() : null; }
@Override protected void onRender(Element target, int index) { super.onRender(target, index); editSupport.doRender(); setAriaState("aria-readonly", "false"); }
@Override public void refresh(boolean headerToo) { super.refresh(headerToo); if (headerToo) { positionLiveScroller(); } if (!preventScrollToTopOnRefresh) { // we scrolled to the top updateRows(0, false); } }
@Override protected void onAdd(ListStore<ModelData> store, List<ModelData> models, int index) { if (enableGrouping) { Point ss = getScrollState(); refresh(false); restoreScroll(ss); } else { super.onAdd(store, models, index); } }
@Override protected void updateColumnWidth(int col, int width) { super.updateColumnWidth(col, width); resizeLiveScroller(); updateRows(viewIndex, true); }
@Override protected void onClear(StoreEvent<M> se) { super.onClear(se); setChecked(false); }
@Override protected void onSelectChange(M model, boolean select) { super.onSelectChange(model, select); updateHeaderCheckBox(); }
/** * Sets the column's header text. * * @param column the column index * @param text the header text */ public void setHeaderText(int column, String text) { getHead(column).setHeaderText(text); }
@Override protected void templateOnColumnHiddenUpdated(int col, boolean hidden, int tw) { super.templateOnColumnHiddenUpdated(col, hidden, tw); updateGroupWidths(); }
protected void onRowOut(Element row) { if (grid.isTrackMouseOver()) { removeRowStyle(row, "x-grid3-row-over"); overRow = null; } }
@Override protected void onAdd(List<? extends M> models) { super.onAdd(models); updateHeaderCheckBox(); }