PDA

View Full Version : Grid & Editing



nbuesing
23 Dec 2011, 10:35 AM
I have not used Ext GWT 2.x, so I don't know if these are bugs, or just user error.

1. If I use a GridInlineEditor and my Grid has combo boxes, I cannot push the saved values back to the datastore. However, GridRowEditor works just fine.

2. I cannot find a way to do any cancel edits. I have a table where a cell is editable only if something else on the row is set to certain state. It seems I should be able to do inspect my row and cancel the edit, but nothing I can find works. I've tried this.

editor.addBeforeStartEditHandler(new BeforeStartEditHandler<Row>() { public void onBeforeStartEdit(BeforeStartEditEvent<Row> event) {
event.setCancelled(true);
}
});

Now if I look at the GridRowEditing, I done see how editing is ever canceled (the BeforeStartEditEvent is created (no events firing on it) and the isCancelled() would also be false (I think).

@Override
public void startEditing(GridCell cell) {
if (getEditableGrid() != null && getEditableGrid().isAttached() && cell != null) {
CancellableEvent ce = new BeforeStartEditEvent<M>(cell);
if (ce.isCancelled()) {
return;
}
cancelEditing();
M value = getEditableGrid().getStore().get(cell.getRow());

Any information/thoughts on this would be appreciated.

nbuesing
23 Dec 2011, 10:40 AM
realized I forgot to mention version, 3.0.0 beta 1.

sven
24 Dec 2011, 4:33 AM
Your second problem is already fixed in SVN. The other one will be looked at.

nbuesing
27 Dec 2011, 6:27 AM
The issue with inline editing was reproduced with your example, InlineEditingGridExample, within our code. So, if this is not an outright issue with inline editing, it is probably and issue with the parent container widgets (we have some parentage that causes this behavior to occur).

I am going to strip out the container stuff (as much as I can) to see if that is indeed the issue.

Thanks.

nbuesing
27 Dec 2011, 7:17 AM
I was able to take the 3.0.0.beta1 example, InlineEditingGridExample, and add it directly in the entry point as shown below (I tried both RootLayoutPanel and RootPanel). In any case, once the combo-box looses focus, the value goes back to previous value.

public class MyEntryPoint implements EntryPoint {
public void onModuleLoad() {
InlineEditingGridExample w = new InlineEditingGridExample();
RootLayoutPanel.get().add(w.asWidget());
//RootPanel.get().add(w.asWidget());

}
}

Now "RowEditingGridExample" does work, but I have noticed another issue I'm curious about.

If I take the code from AbstractGridEditingExample and modify it (added the System.out.println), whenever I edit the row that system out continuously prints out as long as I'm editing the row. It developer mode I see 5 "parse " system outs in every second. I don't have to do anything, and it doesn't matter which cell has focus during row-edit mode. As long as the row is in edit mode, this system out gets printed indefinitely at a rate of 5 / second.

SimpleComboBox<Light> combo = new SimpleComboBox<Light>(new StringLabelProvider<Light>());
combo.setPropertEditor(new PropertyEditor<Light>() {


@Override
public Light parse(CharSequence text) throws ParseException {
System.out.println("parse " + text.toString());
return Light.parseString(text.toString());
}


@Override
public String render(Light object) {
return object == null ? Light.SUNNY.toString() : object.toString();
}
});