Skip to main content
Inspiring
June 9, 2009
Question

Hitting ENTER in a DataGrid editable cell

  • June 9, 2009
  • 1 reply
  • 715 views

Here's a question for you. I have a dataGrid that I want to be able to edit only when the user clicks on a particular button. When this happens, I make the dataGrid editable and I make that particular column editable. After the user modifies the cell's content and hits ENTER, I want the edit cell to close and the dataGrid to once again become non editable. Here's the code in my Key.onKeyUp listener:

if(Key.getCode() == Key.ESCAPE || Key.getCode() == Key.ENTER)
{
     my_dg.getColumnAt(2).editable = false;
     my_dg.editable = false;
}

If the user hits ESC, the edit box closes correctly. If he hits the ENTER key, the edit box remains visible until he hits ENTER once more. Only then does it disappear. How can I make it close corretly the first time?

This topic has been closed for replies.

1 reply

June 10, 2009

Try breaking up the if statement into an if elseif statement? Then use traces to figure out where it's going wrong.

tatiana1Author
Inspiring
June 10, 2009

Hi, I've tried that, but I get the same result. It goes through the commands, but it doesn't seem to close the edit box.

P.S. Do you know how to programmatically interrupt an FileReference.upload or FileReference.download command while executing?

June 10, 2009

No I'm not sure how to do that. Maybe you could create a dummy connection and in the middle of upload or download change the connection on it so it stops?