Derrell Lipman wrote:
On Thu, Oct 8, 2009 at 09:14, skar <[email protected] <mailto:[email protected]>> wrote:

    Derrell Lipman wrote:

    I think you're going about this in the wrong way. There is
    already an event intended for this purpose. When the editor is
    finished (your second press of "Enter"), the event "dataEditied"
    will be fired. This is a data event and its data is a map with
    row, col, oldValue, and value as its members. That's the
    appropriate place to save your data to the server.
    Thanks Derrell. That's what I'm doing. I'm catching this event,
    then sending it to the server. If it says data invalid, then I set
    this row back to the old value, which I've saved already. Next I
    focus on that cell again and startEditing on the table. And it
    works. The only problem is, I can't set the celleditor's value to
    the new value the user tried setting, that way the app will be at
    where it was before the save attempt. I can set the text field of
    the celleditor by accessing the private vars of the table's pane,
    but I don't like it. Seems like this is the best I can do now.


Call table.setValue(event.col, event.row, event.oldValue) before you call table.startEditing() and you should be all set.
Yup, tableModel.setValue does the job. I was using setRows previously which also worked fine. However, what I want is the state to be like before the save was attempted.

Before pressing enter, the user has the celleditor open with his new value and the tableModel has the old value. Now, I have restored the old value to the tableModel. But the celleditor has the old value, not the new value he tried. That way, any long change he made with a small mistake can be corrected easily by the user.

cheers,
skar.

--
--
The life so short, the craft so long to learn.
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to