Groups | Blog | Home
all groups > flash actionscript > april 2004 >

flash actionscript : Dynamic Variable help with Datagrid


joegraphic
4/19/2004 10:43:27 PM
I am using LoadVariablesNum to bring in arrays from an asp file. The arrays are:
records_list_1
records_list_2
records_list_3
The arrays are created based on the number of records in the database and the
arrays hold information like name and email address.
I'm wanting to load that data into the datagrid.
Well here is the code that i am working with and would like to make dynamic:

function setData(){
Records_array_1 = Records_list_1.split(",");
Records_array_2 = Records_list_2.split(",");
Records_array_3 = Records_list_3.split(",");
Records_array_4 = Records_list_4.split(",");

var dP = new Array();

dP[0] = {Records:Records_array_1[0], ID:Records_array_1[1],
Name:Records_array_1[2],Email:Records_array_1[3], Date:Records_array_1[4],
Time:Records_array_1[4]};
dP[1] = {Records:Records_array_2[0], ID:Records_array_2[1],
Name:Records_array_2[2],Email:Records_array_2[3], Date:Records_array_2[4],
Time:Records_array_2[4]};
dP[2] = {Records:Records_array_3[0], ID:Records_array_3[1],
Name:Records_array_3[2],Email:Records_array_3[3], Date:Records_array_3[4],
Time:Records_array_3[4]};
dP[3] = {Records:Records_array_4[0], ID:Records_array_4[1],
Name:Records_array_4[2],Email:Records_array_4[3], Date:Records_array_4[4],
Time:Records_array_4[4]};

Grid.setDataProvider(dP);
}

[h]What I would like to do is dynamically split the records and populate the
datagrid with like a for loop. [/h]It could be separate for loops but you get
the idea of what I am trying to do. The code below is not correct. How do I
make it correct and accomplish this task.
for (var i=0; i<Num_records; i++) {
Records_array_ [h]+i[/h]=Records_list_[h]+i[/h].split(",");
dP[[h]i[/h]] = {Records:Records_array_[h]i[/h][0],
ID:Records_array_[h]i[/h][1],
Name:Records_array_[h]i[/h][2],Email:Records_array_[h]i[/h][3],
Date:Records_array_[h]i[/h][4], Time:Records_array_[h]i[/h][4]};

Thanks in advance!

joegraphic
4/20/2004 9:35:46 PM
I noticed that some else posted something similar to my question in the data
integration forum.


http://www.macromedia.com/cfusion/webforums/forum/messageview.cfm?catid=294&thre
adid=814340&CFID=18840443&CFTOKEN=1dbaf5d03c42ef1d-0295E266-B009-135D-66E82D206D
338D87&jsessionid=48303475851082375135847

title: how to make dynamic columns for datagrid????

Can anyone answer this?
AddThis Social Bookmark Button