/** * Returns the number of visible columns. * * @return the visible column count */ public int getColumnCount(boolean visibleOnly) { if (visibleOnly) { int count = 0; for (ColumnConfig c : configs) { if (!c.isHidden()) { count++; } } return count; } return configs.size(); }
/** * Returns true if the column is hidden. * * @param colIndex the column index * @return true if hidden */ public boolean isHidden(int colIndex) { ColumnConfig c = getColumn(colIndex); return c != null && c.isHidden(); }
/** * Returns the total width of all columns. * * @param includeHidden true to include hidden column widths * @return the total */ public int getTotalWidth(boolean includeHidden) { int w = 0; for (ColumnConfig c : configs) { if (includeHidden || !c.isHidden()) { w += c.getWidth(); } } return w; }
/** * Sets if a column is hidden. * * @param colIndex the column index * @param hidden true to hide the column */ public void setHidden(int colIndex, boolean hidden) { ColumnConfig c = getColumn(colIndex); if (c != null && c.isHidden() != hidden) { c.setHidden(hidden); ColumnModelEvent e = new ColumnModelEvent(this, colIndex); e.setHidden(hidden); fireEvent(Events.HiddenChange, e); } }
public void updateWidth(int width) { if (!config.isHidden()) { El td = el().findParent("td", 3); td.setWidth(width); el().setWidth(width - td.getFrameWidth("lr"), true); Element th = getTableHeader(column); th.getStyle().setPropertyPx("width", width); } }
private Head getHead(int index, boolean back) { ColumnHeader header = grid.getView().getHeader(); int cols = grid.getColumnModel().getColumnCount(); if (!back) { for (int i = index; i < cols; i++) { ColumnConfig config = grid.getColumnModel().getColumn(i); if (!config.isHidden() && !config.ariaIgnore) { return header.getHead(i); } } } else { for (int i = index; i > -1; i--) { ColumnConfig config = grid.getColumnModel().getColumn(i); if (!config.isHidden() && !config.ariaIgnore) { return header.getHead(i); } } } return null; }
protected void doFocus(int colIndex) { if (isVisible()) { ColumnModel cm = this.grid.getColumnModel(); for (int i = colIndex, len = cm.getColumnCount(); i < len && i >= 0; i++) { ColumnConfig c = cm.getColumn(i); if (!c.isHidden() && c.getEditor() != null) { c.getEditor().getField().focus(); break; } } } }
protected int getTargetColumnIndex(Point pt) { for (int i = 0, j = 0; i < grid.getColumnModel().getColumnCount(); i++) { ColumnConfig c = grid.getColumnModel().getColumn(i); if (!c.isHidden()) { if (El.fly(grid.getView().getHeaderCell(i)).getRegion().right >= pt.x) { return j; } j++; } } return -1; }
for (int k = mark; k < (mark + colspan); k++) { ColumnConfig c = cm.getColumn(k); if (c.isHidden()) { mark++; continue;
public void updateColumnHeadings() { int cols = grid.getColumnModel().getColumnCount(); for (int i = 0; i < cols; i++) { ColumnConfig config = grid.getColumnModel().getColumn(i); if (!config.isHidden()) { ColumnHeader header = grid.getView().getHeader(); if (header != null) { Head h = header.getHead(i); if (h != null && h.isRendered()) { Filter f = getFilter(config.getDataIndex()); if (f != null) { h.el().setStyleName(filterStyle, f.isActive()); } } } } } }
protected void onKeyRight(GridEvent<M> ce) { if (GXT.isFocusManagerEnabled() && selectedHeader != null) { ColumnHeader ch = grid.getView().getHeader(); int idx = ch.indexOf(selectedHeader) + 1; ColumnConfig config = grid.getColumnModel().getColumn(idx); while (config != null) { if (!config.isHidden()) { Head h = getHead(idx, false); selectedHeader = h; grid.getView().getHeader().selectHeader(idx); break; } else { idx++; config = grid.getColumnModel().getColumn(idx); } } } if (GXT.isAriaEnabled() && selectedGroup != null) { groupingView.toggleGroup(selectedGroup, true); } }
protected void onKeyLeft(GridEvent<M> ce) { if (GXT.isFocusManagerEnabled() && selectedHeader != null) { ColumnHeader ch = grid.getView().getHeader(); int idx = ch.indexOf(selectedHeader) - 1; ColumnConfig config = grid.getColumnModel().getColumn(idx); while (config != null) { if (!config.isHidden()) { Head h = getHead(idx, false); selectedHeader = h; grid.getView().getHeader().selectHeader(idx); break; } else { idx--; config = grid.getColumnModel().getColumn(idx); } } } if (GXT.isFocusManagerEnabled() && selectedGroup != null) { groupingView.toggleGroup(selectedGroup, false); } }