I am trying to create a multidimensional array from a few lists I have in my VF controller. The Lists are correct, because when I output them just as individual tables, I get all the correct values. I am trying to load them into an array that looks likes this:
DataSet= [ [Name1, URL1, Login1, Created1],
[Name2, URL2, Login2, Created2],
[Name3, URL3, Login3, Created3],
[Name4, URL4, Login4, Created4],
.....
];
Here is how I am trying to construct the array. I am pushing all the List values into each of their own individual arrays, then looping them into the array in the order I wanted: Name(n), URL(u), Login(e), Created(c).
<script>
n = new Array();
<apex:repeat value="{!names}" var="name">
n.push('{!name}');
</apex:repeat>
u = new Array();
<apex:repeat value="{!urls}" var="url">
u.push('{!url}');
</apex:repeat>
e = new Array();
<apex:repeat value="{!logins}" var="logs">
e.push('{!logs}');
</apex:repeat>
c = new Array();
<apex:repeat value="{!created}" var="create">
c.push('{!create}');
</apex:repeat>
var DataSet= new array(5000);
var i=0;
var j=0;
for(i;i<n.length;i++){
for(j;j<3;j++){
if(j=0) DataSet[i][j] = n[i];
if(j=1) DataSet[i][j] = u[i];
if(j=2) DataSet[i][j] = e[i];
if(j=3) DataSet[i][j] = c[i];
}
}
alert('test');
</script>
I tested all the arrays, they are display properly, I run into an issue on the looping. Let me know if there's something I did wrong.
Thanks in advanced.