mattjcurry
9 Dec 2010, 2:07 PM
I have an editor grid with dynamic columns. The number of columns depends on the size of a certain list.
What I have found is that even if I call grid.reconfigure(store, columnmodel), that the new columns are not clickable.
My goal is to have an editor attached to them, but the editor does not appear to work. The only columns that are selectable are the ones that were in the original grid.
public void setColumns(List<ColumnConfig> newCols) {
this.cols = newCols;
for (int i=0; i < cols.size(); i++) {
cols.get(i).setColumnStyleName("tbl-head");
cols.get(i).setNumberFormat(NumberFormat.getFormat("0"));
//GWT.log("column : " + i);
}
ColumnModel model = new ColumnModel(cols);
GWT.log(model.getColumnCount() + "columns in model");
for(int i=1; i < cols.size(); i++) {
SpinnerField spinnerField = new SpinnerField();
spinnerField.setIncrement(1);
spinnerField.setMinValue(0);
spinnerField.getPropertyEditor().setType(Integer.class);
spinnerField.getPropertyEditor().setFormat(NumberFormat.getFormat("0"));
CellEditor spinEditor = new CellEditor(spinnerField);
cols.get(i).setEditor(spinEditor);
}
lbGrid.reconfigure(lbStore, model);
}
What I have found is that even if I call grid.reconfigure(store, columnmodel), that the new columns are not clickable.
My goal is to have an editor attached to them, but the editor does not appear to work. The only columns that are selectable are the ones that were in the original grid.
public void setColumns(List<ColumnConfig> newCols) {
this.cols = newCols;
for (int i=0; i < cols.size(); i++) {
cols.get(i).setColumnStyleName("tbl-head");
cols.get(i).setNumberFormat(NumberFormat.getFormat("0"));
//GWT.log("column : " + i);
}
ColumnModel model = new ColumnModel(cols);
GWT.log(model.getColumnCount() + "columns in model");
for(int i=1; i < cols.size(); i++) {
SpinnerField spinnerField = new SpinnerField();
spinnerField.setIncrement(1);
spinnerField.setMinValue(0);
spinnerField.getPropertyEditor().setType(Integer.class);
spinnerField.getPropertyEditor().setFormat(NumberFormat.getFormat("0"));
CellEditor spinEditor = new CellEditor(spinnerField);
cols.get(i).setEditor(spinEditor);
}
lbGrid.reconfigure(lbStore, model);
}