PDA

View Full Version : Cannot disable checkboxes in EditorTreeGrid



andreea.spirea
21 Jul 2009, 6:49 AM
Hi,

I have an EditorTreeGrid with several columns containing checkboxes, and I am trying to disable the editing for a certain column, so far unsuccessfully.

The columns look like this:

CheckColumnConfig invisibleColumn = new CheckColumnConfig(
INVISIBLE, "Invisible", 50);
//......................
tree.addPlugin(invisibleColumn);
and then I tried the following in various combinations:


CheckBox box = new CheckBox();
box.disable();
box.setReadOnly(true);
invisibleColumn.setEditor(new CellEditor(box));
invisibleColumn.getEditor().disable();
I tried to disable only the checkbox or only the editor, and I also tried to do this in a listener for Render event.

Could you please have a look at this?
Thanks.

sven
21 Jul 2009, 6:56 AM
Moving this to the help forum.

A checkbox column is not using an editor. You need to listen to the beforeselect event and cancel that. Than the checkbox is not checkable and so the column not selectable.

andreea.spirea
21 Jul 2009, 8:02 AM
Hi,

Thank you for the fast response.

Following that, I removed all the setEditor calls and I tried to add listeners for BeforeSelect, but the event is not fired.

I tried something basic like:


invisibleColumn.addListener(Events.BeforeSelect,
new Listener<BaseEvent>() {
public void handleEvent(
BaseEvent be) {
GWT.log("before select fired", null);
}
});but it never gets to the log. The same thing if I add the listener to the tree.
I also tried with BeforeCheckChange, but still nothing.

sven
21 Jul 2009, 8:03 AM
You dont setup that on the column but on the grid directly.

andreea.spirea
21 Jul 2009, 8:14 AM
Sorry for me not being more specific, when I wrote tree in the previous post, i meant the EditorTreeGrid. So, I add the listener to it, and still nothing happens.

Earlier, I had tried this:


entitiesTree.addListener(Events.BeforeSelect,
new Listener<TreeGridEvent<MyModel>>() {
public void handleEvent(
TreeGridEvent<MyModel> be) {
GWT.log("before select fired", null);
}
});

andreea.spirea
22 Jul 2009, 6:57 AM
Hi, after a few other tries, I did a search on BeforeSelect event and where it gets fired,

so i did the following and it gets into the handler:



entitiesTree.setSelectionModel(new TreeGridSelectionModel<MyModel>());
entitiesTree.getSelectionModel().addListener(Events.BeforeSelect,
new Listener<BaseEvent>() {
public void handleEvent(
BaseEvent be) {
GWT.log("before select fired", null);
}
});