dhtmlxGrid attached to dhtmlxLayout and parse JSArray?

Is it possible to have a grid inside a layout cell and then parse a javascript array into the grid, as per the code below:

var dhxLayout, dhxGrid; var arrData = new Array[['MC001','Material 1', '163'],['MC002','Material 2', ''],['MC003','Material 3', '21'],['MC004','Material 4', '4'],['MC005','Material 5', '2x4'],['MC001','Material 1', '673']]; function OnLoad() { dhxLayout = new dhtmlXLayoutObject("parentDiv", "2U"); dhxGrid = dhxLayout.cells("a").attachGrid(); dhxGrid.setImagePath("codebase/imgs/"); dhxGrid.setHeader("MatCode, MatDesc, MatSize"); dhxGrid.parse(arrData,"jsarray"); }

At the moment, with that code, I seem to get the grid inside the layout, but I just get a grey header, with no columns and no data.

Modify your code according to the example below:

var arrData = [[‘MC001’,‘Material 1’, ‘163’],[‘MC002’,‘Material 2’, ‘’],[‘MC003’,‘Material 3’, ‘21’],[‘MC004’,‘Material 4’, ‘4’],[‘MC005’,‘Material 5’, ‘2x4’],[‘MC001’,‘Material 1’, ‘673’]];

Many thanks for your reply. Looks like I didn’t need to declare it as an array then?

I haven’t been able to test your suggestion yet as I’ve now changed my approach. My application uses a VB DLL, so I’ve written a function within that DLL to take a list of parameters and build up an XML string, which is then passed to the javascript datagrid initialisation function and is loaded with the grid.parse method. Works like a charm! :smiley: