-
15 Feb 2011 7:27 AM #1
display correct value in celleditor of RowEditorGrid
display correct value in celleditor of RowEditorGrid
Hi
In my grid, I display Car models. The model looks like:
private Integer vehicleId;
private Map<Integer, Driver> drivers
The drivers are displayed in the correct order (which is indicated by the key of the map), using a cell renderer, and this works fine (simplified):
public Object render(BeanModel model, String property, ColumnData config, int rowIndex, int colIndex,
ListStore<BeanModel> store, Grid<BeanModel> grid) {
Vehicle vehicle = model.getBean();
return vehicle.getDriverMap().get(colIndex).getName();
}
The problem however is, when doube-clicking the row to enable inline editing, the attached editor (a text field) is empty, because GXT can't resolve the correct driver from the the drivermap. Is there a way to do this anyway, or can't beanmodels contain collections? This is a problem, as the number of drivers varies.
thanks for your help
Kurt
-
12 Apr 2011 2:13 AM #2
Try this.
Code:TextField<String> text = new TextField<String>(); text.setAllowBlank(false); column.setEditor(new CellEditor(text) { @Override public Object preProcessValue(Object value) { BeanModel model = store.getAt(row); Vehicle vehicle = model.getBean(); return vehicle.getDriverMap().get(col).getName(); } @Override public Object postProcessValue(Object value) { BeanModel model = store.getAt(row); Vehicle vehicle = model.getBean(); vehicle.getDriverMap().get(col).setName((String)value); store.update(model); this.cancelEdit(); return null; } });
Similar Threads
-
[OPEN] [FIXED-429][2.x/3.x] IE8 Active tab display not quite correct
By sdrew in forum Ext 3.x: BugsReplies: 12Last Post: 21 Mar 2011, 3:47 AM -
Tabpanel not display the correct fields
By riquier.mairesse@free.fr in forum Ext 3.x: Help & DiscussionReplies: 0Last Post: 23 Aug 2010, 4:54 AM -
[RowEditorGrid] How to add Delete button ?
By Yacho in forum Ext GWT: DiscussionReplies: 0Last Post: 3 Dec 2009, 6:12 AM -
[RowEditorGrid] How to add Delete button ?
By Yacho in forum Ext 2.x: Help & DiscussionReplies: 0Last Post: 3 Dec 2009, 5:28 AM -
Setting and display correct item in combobox
By dinosauro in forum Ext 2.x: Help & DiscussionReplies: 4Last Post: 6 Oct 2008, 12:37 AM


Reply With Quote