PDA

View Full Version : Disabling a particular cell of an editable grid



ales
7 Mar 2011, 7:56 AM
Hi,

I'm working on a project in which I have an editable grid.

In my grid, I have to disable a particular cell according to a property in my model.

I tried some methods, but I never could disable my particular cell.

I also tried the method below but it doesn't work (I think the event was never catched) :



grid.getSelectionModel().addListener(Events.BeforeSelect, new Listener<SelectionEvent<Stock>>() {
public void handleEvent(SelectionEvent<Stock> be) {
if (be.getIndex() == 0) {
be.setCancelled(true);
}
}
});


Can anyone help me ? I'm lost...

Thanks

sven
7 Mar 2011, 11:13 PM
The event you need to cancel is Event.BeforeEdit on the grid

ales
8 Mar 2011, 12:41 AM
Thanks, this is what I did finally.

The problem I have now is that I want to access a property in my model and if this property has a particular value, I want to disable the cell which contains this property.

How can I access this model property in my handleEvent method() ?

ales
8 Mar 2011, 1:05 AM
Sven, finally I found a solution.

Thank you