PDA

View Full Version : Editor grid value clearing problem



praveenmj
22 Mar 2012, 4:43 AM
Hi,

I am using GXT EditorGrid widget for my requirement having 3 columns. first column has Combobox dropdown and second columns would be textfield/combobox based on the selection of first column value and third column will have combobox dropdown. Now my requirement is If i change the value of the first column dropdown, then the second column value should cleared i have used the following code. here the value is cleared but when i change the dropdown value of third column also

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

@Override
public void handleEvent(GridEvent<ModelData> be) {
// TODO Auto-generated method stub
int rowIndex = be.getRowIndex();
int colIndex = be.getColIndex();
ModelData model = be.getModel();
//if(colIndex==2){
final String metaName = (String)model.get("FirstColumn");
System.out.println("AfterEditMeta name is = " + metaName);

System.out.println("AfterEdit model.get(\"Value\")===>"+model.get("Value"));
if(colIndex==2 && comboMetaName.getValue() != null ){
System.out.println("AfterEditMeta be.getModel().get(be.getProperty()= "+be.getModel().get(be.getProperty()));
be.getModel().remove("SecondColumn");
System.out.println("AfterEdit model.remove(\"Value\")===>"+model.get("Value"));
}
//}
}

});
any idea /suggestions welcome. how can i do it with editor grid.