PDA

View Full Version : [FIXED] Clicking on a cell doesn't bring up editor if the current cell being edited is dirty.



nbuesing
13 Feb 2012, 1:04 PM
If you are editing a Grid with an GridInlineEditor, single click focus event doesn't fire if there are changes in the cell you are currently editing.

What works (scenario A)
1. Select Cell
2. Make no changes
3. Select another cell
4. the second cell is now editable

What doesn't work (scenario B)
1. Select Cell
2. Make a change
3. Select another cell
4. the second cell is NOT editable (the editable cell is done editing, but you must click again to edit the other cell).

I am using Grid, GroupingView, GridInlineEditor, and having setAutoCommit(true) on the datastore. I do not think the auto-commit or the grouping view affect this in any way, however.

Now, when you click a cell where there are not changes in the editor, then the method AbstractGridEditing.onClick() is called, when there are changes in the current cell, this is not called.

It seems that the completeEditing functionality that gets involved if the cell is dirty is preventing the event being fired on the cell that you select.

In scenario A, there are two GWT events onBlur and onClick

In scenario B, it seems that the value change event is preventing the onBlur and onClick events from firing, but I'm not completely sure what is going on here yet.

As I'm writing this email and trying to provide more context, I see the following in TriggerFieldCell



// Blur the element.
// calling super.finishEditing causes the input element to be blurred which is stopping focus of the the field
// that was clicked
clearViewData(key);
clearFocusKey();
super.onBlur(lastContext, parent.<XElement> cast(), value, null);


Based on that comment, I get the impression that somthing was changed that should cause this to now work (or is this a TODO?)

WesleyMoy
17 Feb 2012, 2:59 PM
Are you still noticing this problem with beta 3? In neither my quick tests nor the beta 3 Explorer (http://www.sencha.com/examples-dev/#ExamplePlace:inlineeditablegrid) is this showing up. If you're still noticing this occurring, what browser/OS are you using, and are you in production or development mode? Also, since I'm not able to reproduce the issue, it would be helpful if you could include a short example of what you're trying to do - preferably with its own EntryPoint.

nbuesing
17 Feb 2012, 7:37 PM
Your right, this isn't the norm, but for my scenario it does happen. Maybe there is a different want to get the refresh I need...

The issue is I have scenarios where I must redraw all the cells in the row and/or all the cells in the table depending on what changes in the editing of a cell. Once I put

datastore.fireEvent(new StoreUpdateEvent<Item>(datastore.getAll()));

in the onCompleteEdit (so the table redraws), then I get this click issues

Now this example is rather contrived, but is does show the behavior. If I remove the mechanism I use to refresh the table, then the table doesn't refresh..

Aso, why does event.getEditCell(), return null in the complete edit handler? I would like to know which cell completed editing from the event (instead of storing my own state to achieve this).

In my real-word case I gray out cells based on what was entered in other cells.

I have never liked using the datastore.fireEvent() so maybe there is an easier way to get the refresh that I need.

Thanks.



editor.addCompleteEditHandler(new CompleteEditHandler<Item>() {
@Override
public void onCompleteEdit(CompleteEditEvent<Item> event) {

Item prev = null;
for (Item item : datastore.getAll()) {

if (prev != null) {
item.setOutput(prev.getInput());
}

prev = item;
}

datastore.fireEvent(new StoreUpdateEvent<Item>(datastore.getAll()));
}
});


31862

WesleyMoy
15 Mar 2012, 3:40 PM
I've now been able to notice the behaviour you describe but seemingly only when clicking between cells in the same row. Thanks for both the detailed report and for the update. I'll file a bug against the team and will update this thread with any developments.

nbuesing
16 Mar 2012, 7:09 AM
In using your Inline Editable Grid I can reproduce as well (same row only) as you described.

I'm curious why it is different for me (I have datastore set to autocommit). I thought it had somethign to do with the datastore.fireEvent() I was doing, but I disabled that and it still occurs. I'm hoping it is the same issue, but will try to figure out what is causing the different for me (since it occurs between rows as well, just within the same row).

Thanks.

darrellmeyer
16 Mar 2012, 2:40 PM
The bug occurs anytime the value is updated when clicking to a different cell in the same row.

This is now fixed in SVN. You can see and validate the change here:

http://staging.sencha.com:8080/examples-dev/#ExamplePlace:inlineeditablegrid

nbuesing
23 Mar 2012, 8:20 AM
I have tested the latest snapshot (as of 3/23/2012) and the behavior I have remains.

I will try to create a test case for it. Known differences

1) I have autocommit of the datastore to true
2) I refresh the grid (through firing store update events) and there could be a timing issue with that.

Again, i will try to create a test case of this behavior.