You can populate data into a datagrid using the javascript push method. The Javascript push method allows you to create an object with the same apikeys contained in your datagrid and push data into it. For each row pushed into the datagrid, a new row will be spawned in the datagrid itself.

An example of a form that illustrates this functionality is located here and downloadable from the Square 9’s forms gallery.

In the above example, the code that populates the second datagrid is illustrated below:

// Clear my target datagrid named "datagrid2"
data.datagrid2.length = 0;

// Loop through the first datagrid, named "datagrid"
for(var i=0;i<data.datagrid.length;i++)
// Create a variable called "item" which holds the values we want to push, First2, Last2, represent the fields in the second datagrid we are pushing to.
	var item = {'First2':data.datagrid[i].First,'Last2':data.datagrid[i].Last};
	// Log the Item to the Developer console so we can see the object before it's pushed.

// Write the data