3 Replies Latest reply on Oct 11, 2010 3:23 PM by Flex harUI

    How to programmatically edit an ADG cell upon key down

    fedster72 Level 1

      I'd like to programmatically open an AdvancedDataGrid cell for editing when the user presses a key (e.g. the letter 'a' on the keyboard).

      My original plan was to:

      • listen to KeyDown events on the ADG
      • when the user presses a key, open a specific cell with editedItemPosition
      • re-dispatch the same KeyboardEvent

      The issue here seems to be that the even gets re-dispatched before the editor is open, and unfortunately I can't seem to find a way to know when the itemEditorInstance is not null.

       

      The alternative approach I took was to

      • listen to KeyDown events on the ADG
      • when the user presses a key, open a specific cell with editedItemPosition
      • assign a value to key value contained in the even to the cell

      Two smaller issues here. One, the cell opens up with the text fully selected, so if the user types "orange" he/she would get "range". I guess I could set the cursor to the end of the cell, but I think I need to access the itemEditor yet again, and am not sure how to do that (unless I tweak all itemEditors used in my ADG to open that way, which I guess I could do). Two, the value of the cell is now changed in the underlying dataProvider, so ESC doesn't lead to the usual reverting to old value of the cell. I guess I could re-implement that too, but am wondering if there isn't a simpler way to go about this whole thing.

       

      Would love to hear any opinions / comments / pointers to entries that discuss related matters.

       

      thank you

       

      f