PDA

View Full Version : help using Array !



libertux
27 Nov 2007, 7:43 AM
Hi every body ;)
I try to use a Array i do this :


var projectArray = new Array;
...
var getPrjInfo = function(){

var prname = Ext.getCmp('proname');
var prnameval = prname.getValue();


var proj = new Ext.data.Node ({

id: 'proj' + (++projid),
text:prnameval

});

projectArray.append(proj);

};


but i have a syntax error then haw can i insert into an array ?
THKS

heidtmare
27 Nov 2007, 7:46 AM
http://www.w3schools.com/js/js_obj_array.asp

I'd start by changing

var projectArray = new Array;
to

var projectArray = new Array(); or var projectArray = []

hendricd
27 Nov 2007, 2:57 PM
Then:

projectArray.push(proj);