Single Click Cell Editing and More

The Spark DataGrid starts cell editing when a selected cell is clicked. But what if you want your DataGrid to start editing a cell regardless of whether the cell is selected or not? It is pretty easy to do this by adding a few listeners to the DataGrid. In a future release of the Spark DataGrid we will most likely add a property that will allow you to choose which method is used to start an editor session.

Download the project to see how it’s done.

The project also shows show to use the DateField and the ColorPicker as cell editors.

Run the application (required Flash Player 10.2 or greater)

13 Responses to Single Click Cell Editing and More

  1. smithfox says:

    Thank your great example!!


  2. Hello,
    I have a problem with your code: I copied and pasted the part related to single click editing in a grid with a set of plain GridColumns (no custom renderer or editor); it works great for the first click, but then, if you click outside the editor (say for example on the cell to the right of it), the editor doesn’t always show up and the selection gets moved randomly (as far as I can tell) on the row.
    Any idea on how to fix this?
    Thank you,


  3. Duong says:

    It would be great if you show us how to add copy/paste support using Ctrl+c/v, since by default we don’t have them in “keyboard and mouse shortcuts with item editors for the Spark DataGrid”.


  4. dloverin says:

    Support for copy/paste is built into the text component that is used for the cell editor. You don’t need to add it yourself.

  5. Duong says:

    I thought so, too, but when I use a normal TextInput (or TextArea etc) as a renderer, the component does not listen to keyboard ctrl+c/v anymore. I have to right click to paste the content from the clipboard.


    • dloverin says:

      Are you sure the TextInput has focus before you paste into the field. Try clicking on the control first before the paste operation.

      Check if your custom control is overriding the setFocus() method. This could be the problem. See for an example.

      • Duong says:

        Thank you for your answer. I’ve checked again both of your suggestions to make sure but it’s not working.

        The list of supported shortcuts is specified here : , and I’ve had a look at the code, too.


        • dloverin says:

          Given that paste works in my demo, there must be something different about your grid editor. Could you post a small example that demonstrates the problem?

          • Duong says:

            Sorry I couldn’t answer sooner. I’ve taken your example SingleClickCellEditor and replace the line 100 with :

            And then copy/paste just stops working. I think that there’s a logical bug in the process of generating/using the itemEditor inside the DataGrid, where the EditManager does not dispatch COPY/PASTE event anymore.

            Maybe it’s an Air related problem because I’ve tested the NumericStepper example found on, the copy/paste works on my browser but not with my air project.

            To work around this, I’m not sure where I should listen to and dispatch those events in my ItemEditor implementation 🙂


  6. marcelo says:

    Thank you very much!!!!