Thank you Derrell ones more....

 

________________________________

Von: Derrell Lipman [mailto:[email protected]] 
Gesendet: Donnerstag, 2. April 2009 19:01
An: qooxdoo Development
Betreff: Re: [qooxdoo-devel] CellEditor

 

On Thu, Apr 2, 2009 at 12:01 PM, Mustafa Sak <[email protected]>
wrote:

i have a problem with my cell renderer, if i want to duplicate a row
with 

    

    var activeTable = this.tabelle[0] ;

    var activeRow = activeTable.getFocusedRow();

    var readRow = activeTable.tableModel.getRowData(activeRow);

    if (activeRow != null) {

       activeTable.tableModel.addRows([readRow],activeRow);

    }

 

it works fine, but all of the duplicates change there values together if
I change one of them.

 

I don't understand why.

In Javascript, if you assign an object or an array to multiple
variables, you haven't actually copied the object or array; you've just
saved a reference to the object or array in the multiple variables.

var a = [ 1, 2, 3 ];
var b = a;
a[0] = 23;
console.log(b[0]); // will print 23

You can use the static method qx.lang.Array.clone() to clone an array.
The static method qx.lang.Object.clone() will non-recursively clone an
object (i.e. if any of the object's members is itself an array or
object, those will not be cloned by this method). 

Using the above example:

var a = [ 1, 2, 3 ];
var b = qx.lang.Array.clone(a);
a[0] = 23;
console.log(b[0]); // will print 1

Derrell

------------------------------------------------------------------------------
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to