Saturday, November 19, 2011

itemEditEnd event mx Datagrid

Some salient points that I came across when working with itemEditEnd event in the mx:DataGrid. Thought I'd share.

  1. In case of editable datagrids, we can do some updation, if required before the completion of the edit by listening to the itemEditEnd event in the DataGrid.
  2. mx:DataGrid also listens to the same event and does some processing before destroying the itemEditor instance for the row.
  3. Flex adds the event listener with a priority of -50 in the DataGrid. The default priority when we add the event listener is 0. Hence, our code will be executed first always.
  4. To override this, we can set the event listener priority less than -50. Doing so will make our code to be executed after the Flex inbuilt code.
  5. We can also add multiple event listeners for the same event with varying priorities, to enable code synchronization.
  6. itemEditEvent does not store the old value and the new value, so we need to pick that ourselves to do some processing on them.
  7. It is also advisable to use the data from the itemRenderer as the old value and that from the itemEditor instance as the new value. Using this from values stored outside may have consequences, we might not like.
So, there it is. Hope this helps someone.

No comments :