I want to populate an array of objects, so that the array should be attached to a grid. This is the format that I require:
data.push({ id: 1, values: { "country": "uk", "age": 33, "name": "Duke", "firstname": "Patience", "height": 1.842, "email": "patience.duke@gmail.com", "lastvisit": "11\/12\/2002" } });
I have key-value pairs of values
, I am not sure exactly how would I be constructing the above object in a loop...??
EDIT:
I have this so far, but I am only adding values, not their respective keys:
var recordValues = [];
//for loop iterator
recordValues.push(colValues[colCount]);
//end for
data.push({ id: recordID, values: recordValues });
colValues
contain the following: "uk", 33, "Duke"...all the possible values in an object..