public void handleEvent(BaseEvent be) { doClean(); } });
@Override protected String doRender(List<ColumnData> cs, List<ModelData> rows, int startRow, int colCount, boolean stripe) { if (!bufferEnabled) { return super.doRender(cs, rows, startRow, colCount, stripe); } return doRender(cs, rows, startRow, colCount, stripe, false); }
public void handleEvent(BaseEvent be) { doUpdate(); } });
protected void doUpdate() { if (grid == null || !grid.isViewReady() || !isBufferEnabled()) { return; } int count = getVisibleRowCount(); if (count > 0) { ColumnModel cm = grid.getColumnModel(); ListStore<ModelData> store = grid.getStore(); List<ColumnData> cs = getColumnData(); boolean stripe = grid.isStripeRows(); int[] vr = getVisibleRows(count); int cc = cm.getColumnCount(); for (int i = vr[0]; i <= vr[1]; i++) { // if row is NOT rendered and is visible, render it if (!isRowRendered(i)) { List<ModelData> list = new ArrayList<ModelData>(); list.add(store.getAt(i)); if (widgetList.size() > i) { widgetList.set(i, new ArrayList<Widget>()); } else { widgetList.add(i, new ArrayList<Widget>()); } String html = doRender(cs, list, i, cc, stripe, true); getRow(i).setInnerHTML(html); renderWidgets(i, i); } } clean(); } }
int rh = getStyleRowHeight(); int[] vr = getVisibleRows(getVisibleRowCount()); String tstyle = "width:" + getTotalWidth() + "px;height:" + rh + "px;"; String tstyleWithOutHeight = "width:" + getTotalWidth() + "px;"; ModelData model = (ModelData) rows.get(j); model = prepareData(model); ColumnData c = cs.get(i); c.css = c.css == null ? "" : c.css; String rv = getRenderedValue(c, rowIndex, i, model, c.name); String cellAttr = c.cellAttr != null ? c.cellAttr : ""; if (isShowInvalidCells() && r != null && !r.isValid(c.id)) { css += " x-grid3-invalid-cell"; if (isShowDirtyCells() && r != null && r.getChanges().containsKey(c.id)) { css += " x-grid3-dirty-cell"; if (isShowDirtyCells() && r != null && r.isDirty()) { alt += " x-grid3-dirty-row";
protected void doClean() { if (grid == null || !grid.isViewReady() || !bufferEnabled) { return; } int count = getVisibleRowCount(); if (count > 0) { int[] vr = getVisibleRows(count); vr[0] -= cacheSize; vr[1] += cacheSize; int i = 0; NodeList<Element> rows = getRows(); // if first is less than 0, all rows have been rendered // so lets clean the end... if (vr[0] <= 0) { i = vr[1] + 1; } for (int len = grid.getStore().getCount(); i < len; i++) { // if current row is outside of first and last and // has content, update the innerHTML to nothing if ((i < vr[0] || i > vr[1])) { detachWidget(i, false); widgetList.set(i, null); cleanModel(ds.getAt(i)); rows.getItem(i).setInnerHTML(""); } } } }
protected int getVisibleRowCount() { int rh = getCalculatedRowHeight(); int visibleHeight = scroller.getHeight(true); return (int) ((visibleHeight < 1) ? 0 : Math.ceil(((double) visibleHeight / rh))); }
protected boolean isRowRendered(int index) { Element row = getRow(index); return row != null && row.hasChildNodes(); }
protected int[] getVisibleRows(int count) { int sc = scroller.getScrollTop(); int start = sc / getCalculatedRowHeight(); int first = Math.max(start, 0); int last = Math.min(start + count, grid.getStore().getCount() - 1); int[] i = new int[] {first, last}; return i; }