I'm having a problem using a checkbox as an item editor within a datagrid.
It might be a bug or maybe I'm doing something wrong.
Either way, I need to fine some resolution/workaround.

In my DataGridColumn definition, I'm setting editable=true and
rendererIsEditor=true for the column with the checkbox. My application
listens for ITEM_EDIT_BEGINNING, ITEM_EDIT_BEGIN, ITEM_EDIT_END,
ITEM_FOCUS_IN and onSelectChange events on the grid.

The majority of times, the checkbox works fine - it displays the proper
status for the underlying data element and it updates the element
correctly as well.  The problem occurs, intermittenly, in the following
scenario

1. Click on a checkbox in row A
- the checkbox toggles status on screen and row A is selected

2. Click on a checkbox in row B
- the checkbox in row B toggles status on screen, row B is selected, but the
checkbox in row A toggles back to it's previous state.

In other words, the checkbox change made in step 1 is lost. This happens on
irregular basis, but is repeatable at least once
every 5-10 trials.

I've found that when the problem occurs, the grid never sends an
item_edit_beggining/item_edit_begin event in step 1.  Consistent
with no item-edit-beginning event, there is no item-edit-end event when
focus changes to row B in step 2.
Without the item-edit-begining/item-edit-end events, the state of the
checkbox toggle in step #1 is not reflected back into the underlying data.
The changing row selection in step 2 has the side-effect of updating the
display list, at which point, the item renderer in row A redraws itself
with the underlying data. Since the underlying data was never changed, the
checkbox in row A flips back to it's original state.

In the checkbox's click handler, I've confirmed that if the parent grid's
editedItemPosition attribute is null when the checkbox is clicked,
then the change in checkbox status will be lost if the grid is redrawn; i.e.
editedItemPosition == null is consistent with never getting the
item-edit-beginning event.

If all of this is clear as mud, thanks for taking the time to read this far
:-)

If anyone has some suggestions (or patch ids?) for why the grid may not
recognize that an item-edit cycle has started when a checkbox
is selected, please let me know.

When the checkbox edit works correctly, the sequence of events I see is

1. Click on a checkbox in row A
          itemEditBegining for row A
          itemEditBegin for row A
          itemFocusIn for checkbox in row A
          checkbox click event for row A
2. Click on a checkbox in row B.
          itemEditBegin for row A <=== correct checkbox state written back
to underlying data
          itemEditBegining for row B
          itemEditBegin for row B
          itemFocusIn for checkbox in row B
          checkbox click event for row B

Thanks,
- Glenn

Reply via email to