PDA

View Full Version : how to call an array in ExtJS



thimmappa494
27 Oct 2010, 3:11 AM
hi all
i have an array like shown below


Ext.reg('picker', Ext.Picker);

Date.monthNames = [
"Active ",
"Passive",
"Value",
"Bargain",
"Vegas"

];

Date.dayNames = [
"LEAPS",
"Earnings",
"Economic",
"Weekly",
"Daily"

];

Date.yearNames = [
"2$",
"1$",
"50 cents",
"25 cents",
"5 cents"

];
and now i am using the array in a function as shown below

function autoSpin()
{
//var Date.monthNames = new Array('Active','Passive','Bargain','Vegas','Value');
// alert("hi");
Date.monthNames.shuffle();

var shuffleresults= Date.monthNames.join("br<>");


alert("hi");

Date.monthNames[0] = shuffleresults.rows.item(0).Date.monthNames[0];
Date.monthNames[1] = shuffleresults.rows.item(1).Date.monthNames[1];
Date.monthNames[2] = shuffleresults.rows.item(2).Date.monthNames[2];
Date.monthNames[3] = shuffleresults.rows.item(3).Date.monthNames[3];
Date.monthNames[4] = shuffleresults.rows.item(4).Date.monthNames[4];

//spinnerId = shuffleresults.rows.item[0].spinnerId;



document.getElementById('months[0]').innerHTML = Date.monthNames[0];
document.getElementById('months[1]').innerHTML = Date.monthNames[1];
document.getElementById('months[2]').innerHTML = Date.monthNames[2];
document.getElementById('months[3]').innerHTML = Date.monthNames[3];
document.getElementById('months[4]').innerHTML = Date.monthNames[4];


Date.dayNames.shuffle();
//var Date.dayNames=new Array('LEAPS','Earnings','Economic','Weekly','Daily');

var shuffleresults1= Date.dayNames.join("<br>");
var len1 = shuffleresults1.rows.length, i;



Date.dayNames[0] = shuffleresults1.rows.item(0).Date.dayNames[0];
Date.dayNames[1] = shuffleresults1.rows.item(1).Date.dayNames[1];
Date.dayNames[2] = shuffleresults1.rows.item(2).Date.dayNames[2];
Date.dayNames[3] = shuffleresults1.rows.item(3).Date.dayNames[3];
Date.dayNames[4] = shuffleresults1.rows.item(4).Date.dayNames[4];

//spinnerId = shuffleresults1.rows.item[0].spinnerId;



document.getElementById('days[0]').innerHTML = Date.dayNames[0];
document.getElementById('days[1]').innerHTML = Date.dayNames[1];
document.getElementById('days[2]').innerHTML = Date.dayNames[2];
document.getElementById('days[3]').innerHTML = Date.dayNames[3];
document.getElementById('days[4]').innerHTML = Date.dayNames[4];



//var Date.yearNames=new Array('2$','1$','50 cents','25 cents','5 cents');
Date.yearNames.shuffle();

var shuffleresults2= Date.yearNames.join("<br>");
var len2 = shuffleresults2.rows.length;



Date.yearNames[0] = shuffleresults2.rows.item(0).Date.yearNames[0];
Date.yearNames[1] = shuffleresults2.rows.item(1).Date.yearNames[1];
Date.yearNames[2] = shuffleresults2.rows.item(2).Date.yearNames[2];
Date.yearNames[3] = shuffleresults2.rows.item(3).Date.yearNames[3];
Date.yearNames[4] = shuffleresults2.rows.item(4).Date.yearNames[4];

//spinnerId = shuffleresults2.rows.item[0].spinnerId;



document.getElementById('years[0]').innerHTML = Date.yearNames[0];
document.getElementById('years[1]').innerHTML = Date.yearNames[1];
document.getElementById('years[2]').innerHTML = Date.yearNames[2];
document.getElementById('years[3]').innerHTML = Date.yearNames[3];
document.getElementById('years[4]').innerHTML = Date.yearNames[4];




}
is this is the correct way to call the array Date.monthNames[] or else is there any other way to call the array