On Thu, Oct 8, 2009 at 10:08, skar <[email protected]> wrote:

>  Derrell Lipman wrote:
>
>
> Hmmm... The cell editor factory is passed col, row, xPos, value, and table.
> Since it gets the table, you could have previously used table.setUserData()
> with the new value, and pull it into the cell editor in the factory.
>
> Just a thought.
>
>  Yes, but I can't get the xPos, pane etc of a table using public APIs,
>
>
> To accomplish what you've described you're trying to do, you don't need nor
> care about xPos, pane, or any such thing. That's all the "internal workings"
> that you aren't supposed to need to care about. What I've described is how
> you can accomplish exactly what I _think_ you're trying to do, all with
> public APIs.
>
> I want the table model data for the edited cell to be the old one and I've
> got it working. Now, I want the cell editor for this cell to be open with
> the old value, as it was before saving. I tried table.setUserData(newvalue)
> like this:
>
> this.table.setFocusedCell(col, row, true);
> this.table.setUserData(newvalue);
> this.table.startEditing();
>
> But the cell's value is still the old one inside the celleditor. Any ideas?
>

setUserData takes two parameters: a key and a value. It's used ONLY by your
code, which can later retrieve the value with getUserData(key). So in your
function that tries to save the data at the server but the server says,
"sorry, can't do it" you could call

   this.table.setUserData("currentCellEditing", event.value);
   this.table.startEditing();

The act of calling startEditing() causes the cell editor factory to be
invoked. Look at qx.ui.table.celleditor.TextField as a simple one to extend.
Your cell editor factory can then call:

  var valueToEdit = table.getUserData("currentCellEditing") ||
cellEditor.originalValue;
  table.setUserData("currentCellEditing", null);

In other words, if there's user data available from a failed save attempt,
it'll put that into the cell editor; otherwise the value from the data
model.

Derrell
------------------------------------------------------------------------------
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