PDA

View Full Version : Change value in grid dynamically



iSpiderman
6 Jul 2009, 4:09 AM
I am struggling what seems to me like something that should be very easy.

I have a combobox and a listener attached to it to change the value of a cell in the same row of a grid as the combobox is.

Searching the web I couldn't find something that works... e.g. I tried:

cbAction.addListener(new ComboBoxListenerAdapter() {
public void onSelect(ComboBox comboBox, Record record, int index) {

if(index==0){
record.set("change", 0.5);
Store.commitChanges();
Store.load();
}
else {
record.set("change", 0.0);
Store.commitChanges();
Store.load();
}
}});


Could anyone help me?

Thanks in advance,

Thomas

iSpiderman
6 Jul 2009, 6:01 AM
Found a possible solution (although I don't think it should be used...)

Instead of

record.set("change", 0.5);
Store.commitChanges();

just enter the value into the grid itself:

Grid.getSelectionModel().getSelected().set("change", 0.5);

Any improvements are very welcome,

Thomas