Categories | Question details Back To List | ||
Grid with subgrid Could you please tell me what is wrong with this xml. I am trying to build a grid with subgrid in PHP. If I output either $xml or $xmlSub independently my grid will populate properly, but when I try to nest them it does not work. Can this be done dynamically or does it only work with xml files as sub grids? public static function getTestSubGrid() { header("Content-type: text/xml"); //Sub grid xml $xmlSub = '<?xml version="1.0" encoding="utf-8"?>'; $xmlSub .= '<rows>'; $xmlSub .= '<head>'; $xmlSub .= '<column width="100" type="edtxt" sort="str" id="column1">Sub Grid Column 1</column>'; $xmlSub .= '</head>'; $xmlSub .= '<row id="1"><cell>Upstream</cell></row>'; $xmlSub .= '</rows>'; //Main grid xml $xml = '<?xml version="1.0"?>'; $xml .= '<rows>'; $xml .= '<head>'; $xml .= '<column width="100" type="sub_row_grid" sort="str" id="column1">Click Me</column>'; $xml .= '</head>'; $xml .= '<row id="1"><cell><![CDATA[' . $xmlSub . ']]></cell></row>'; $xml .= '</rows>'; echo $xml; } Answer posted by dhxSupport on Jun 19, 2009 02:26 In case of sub_row_grid usage, the value of the cell have to be only a URL to the configuration XML of the sub-grid. There is no possibility to insert sub grid xml directly to the main grid xml. If you want to load sub grid via xml string or any othe format you can use "onSubGridCreated" event: mygrid.attachEvent("onSubGridCreated",function(sub,id,ind,value){ //sub - subgrid object //value - value from XML for related cell sub.loadXMLString(any necessary xml string) //or mygrid.load("grid.xml”); return false; //block default logic }); |