Categories | Question details Back To List | ||
DHTMLx Grid producing error dynamically I am using following function: function changeCountry(country) { rLength="<?php echo get_configRates(); ?>"; document.getElementById("maintable").innerHTML=""; for(var i=0;i<rLength;i++) { var div="<div id=\"gridbox_"+i+"\" width=\"100%\" height=\"250px\" style=\"background-color:white;overflow:hidden\"></div>"; var divName="gridbox_"+i; document.getElementById("maintable").innerHTML+=div; mygrid = new dhtmlXGridObject(divName); mygrid.setImagePath("externalfiles/CodeBase/imgs/"); mygrid.loadXML("common/libs/x_dbutil.php?no="+i+"&function=getRates&val=CDo/Smpqamq6gKRZ57fm4sgyTIAqVftN1zg4nudHnhgHvxd6rQ==&country="+country); } } This will load div as well as grid dynamically. Every thing in xml is right. The file is fine. But i get following error Error: parent is null Source File: http://localhost/Calling%20Cards/Fline/externalfiles/CodeBase/dhtmlx.js Line: 1129 Answer posted by dhxSupport on Jun 22, 2009 01:45 This error is not related with dhtmxGrid initialization. Such error can return incorrect "attachHeader" or "attachFooter" methods. Could you please provide us sample of xml which you are using? Answer posted by Muhammad Jafer on Jun 22, 2009 02:18 Following is the xml <rows> − <head> <column width="320" type="ro" align="left" sort="str">Price</column> <column width="110" type="ro" align="left" sort="str">Rate</column> <column width="110" type="ro" align="left" sort="str">Minutes</column> </head> − <row id="0"> <cell>5</cell> <cell>0.0240</cell> <cell>208</cell> </row> − <row id="1"> <cell>10</cell> <cell>0.0240</cell> <cell>417</cell> </row> − <row id="2"> <cell>15</cell> <cell>0.0240</cell> <cell>625</cell> </row> − <row id="3"> <cell>20</cell> <cell>0.0240</cell> <cell>833</cell> </row> − <row id="4"> <cell>25</cell> <cell>0.0240</cell> <cell>1042</cell> </row> </rows> Answer posted on Jun 22, 2009 03:06 i separated the loop where div was created dynamically and initialization of dhtmlx grid and every thing is working fine function changeCountry(country) { rLength="<?php echo get_configRates(); ?>"; document.getElementById("maintable").innerHTML=""; var div=""; for(var i=0;i<rLength;i++) { div+="<div id=\"gridbox_"+i+"\" style=\"height:200px;width:100%;background-color:white;overflow:hidden\"></div>"; } document.getElementById("maintable").innerHTML=div; for(i=0;i<rLength;i++) { mygrid = new dhtmlXGridObject("gridbox_"+i); mygrid.setImagePath("externalfiles/CodeBase/imgs/"); mygrid.loadXML("common/libs/x_dbutil.php?no="+i+"&function=getRates&val=CDo/Smpqamq6gKRZ57fm4sgyTIAqVftN1zg4nudHnhgHvxd6rQ==&country="+country); } } |