View Full Version : Disabling Cells in an editor grid

9 Mar 2011, 4:28 AM
I have an editor grid that has 4 columns. The second column is a combobox and if a certain value is selected in that combobox, users should not be permitted to enter values into columns 3 and 4. I've seen a few ideas on the forum but I'm not sure what the best practices are for disabling specific cells based on a prior value in that same row. Can anyone give me some suggestions?

9 Mar 2011, 6:49 AM
Just add a listener to the BeforeEdit event, and then check if conditions let user edit or not. In case they donīt, cancel the event.

grid.addListener(Events.BeforeEdit, new Listener<GridEvent<ModelData>>(){

public void handleEvent(GridEvent<ModelData> be){
Record record = be.getRecord();
YourComboType value = (YourComboType) record.get("property2ndcolumn");
if (value.equals(whatever) && (be.getProperty().equals("thirdcolumn") || be.getProperty().equals("fourthcolumn"))