Categories | Question details Back To List | ||
How do I reference a subgrid XML inside my parent XML as a variable? I’m trying to use a grid with a subgrid. My XML is stored in a session variable. For example, lets say this is my parent or master xml: var parentXML = ‘’; parentXML += ‘<?xml version="1.0"?>’; parentXML += ‘<rows>’; parentXML += ‘ <row id="1">’; parentXML += ‘ <cell type="sub_row_ajax">[***how do I reference subXML’ variable here?***</cell>’; parentXML += ‘ <cell>Loaded by ajax</cell>’; parentXML += ‘ <cell>John Grisham</cell>’; parentXML += ‘ <cell>12.99</cell>’; parentXML += ‘ <cell>1</cell>’; parentXML += ‘ <cell>24</cell>’; parentXML += ‘ <cell>0</cell>’; parentXML += ‘ <cell>05/01/1998</cell>’; parentXML += ‘ </row>’; parentXML += ‘</rows>’; Let’s say that this is my detail XML: var detailXML = '' ; detailXML += '<?xml version="1.0" encoding="UTF-8"?> ' ; detailXML += ' <rows>' ; detailXML += ' <head>' ; detailXML += ' <column width="50" type="ed" align="left" color="white" sort="str">Status</column>' ; detailXML += ' <column width="150" type="ed" align="left" color="#d5f1ff" sort="str">User Level</column>' ; detailXML += ' <column width="100" type="ed" align="left" color="#d5f1ff" sort="str">User Type</column>' ; detailXML += ' <settings>' ; detailXML += ' <colwidth>px</colwidth>' ; detailXML += ' </settings>' ; detailXML += ' </head>' ; detailXML += ' <row id="1">' ; detailXML += ' <cell>Active</cell>' ; detailXML += ' <cell>1</cell>' ; detailXML += ' <cell>Internal</cell>' ; detailXML += ' </row>' ; detailXML += ' </rows>' ; I construct my grid: mygrid.loadXMLString(parentXML, function(){ mygrid.cells("2",0).open(); }) ; Now my subgrid: mygrid.attachEvent("onSubGridCreated", callback); function callback(sgrid,id,ind,val) { sgrid.loadXMLString(detailXML); // sgrid.enableAutoHeight(true); - enabled by default , so not really necessary sgid.callEvent("onGridReconstructed",[]) //It must force size updates for all sub-grid hierarchy return false; } My question is: how do I reference ‘detailXML’ inside my parent ‘parentXML’? Answer posted by dhxSupport on Mar 18, 2009 02:47 There isn’t possibility to put sub grid xml string as you wish. In the xml structure you are able only to specify path to the xml file. If you want to load sub grid via xml string the only way to do it is to use “onSubGridGreated” event. |