:: Forum >>

changing array data

looking for a simple method for changing array data

thierry
Sunday, June 26, 2005
I finished to understand that we must change the data ouside the widget (the paramater of setDataProperty function).

The widget does not create another array but reads the initial mydata array.

Thanks
thierry
Sunday, June 26, 2005
If you use a javaarray to hold data you probably wants to have the posibility to roll back data for the row

use a clone function to clone a array otherwise there is a risk that you work whith a pointer to the orginal data array.


function cloneObject(what) {
for (i in what) {
if (typeof what[i] == ''object'') {
this[i] = new cloneObject(what[i]);
}
else
this[i] = what[i];
}
}

var myData = [
["MSFT","Microsoft Corporation", "314,571.156", "32,187.000"],
["ORCL", "Oracle Corporation", "62,615.266", "9,519.000"],
["SAP", "SAP AG (ADR)", "40,986.328", "8,296.420"],
["CA", "Computer Associates Inter", "15,606.335", "3,164.000"],
["ERTS", "Electronic Arts Inc.", "14,490.895", "2,503.727"]
];

//make a clone
var myDataOrginalCopy= new cloneObject(myData);
Andersson
Monday, June 27, 2005
ok
but i prefer to have only one array in memory.
The widget points to that array.
I think that is ok like that.
Thierry
Monday, June 27, 2005

This topic is archived.


Back to support forum

Forum search