Hello,
I have kind of a strange problem with row IDs, be it with forEachRow or with getRowId, as shows the following example:
<html>
<head>
<link rel="stylesheet" type="text/css" href="codebase/dhtmlxgrid.css">
<script src="codebase/dhtmlxcommon.js" type="text/javascript"></script>
<script src="codebase/dhtmlxgrid.js" type="text/javascript"></script>
<script src="codebase/dhtmlxgridcell.js" type="text/javascript"></script>
<script type="text/javascript">
function doOnLoad() {
mygrid = new dhtmlXGridObject('gridbox');
mygrid.setImagePath("codebase/imgs/");
mygrid.setHeader("item_nm,item_cd");
mygrid.setSkin("modern");
mygrid.init();
mygrid.loadXML("php/get.php");
//alert("without this alert getRowId or forEachRow will not work!");
rId = mygrid.getRowId(0);
alert(rId); //output: undefined if no alert, rowID if alert
}
</script>
</head>
<body onload="doOnLoad();">
<div id="gridbox" style="width:600px;height:270px;overflow:hidden"></div>
</body>
</html>
(php/get.php just prints some regular xml-code; actually the file is taken from dhtmlxGrid/samples/04_dataprocessor/php/ and the html-code from dhtmlxGrid/samples/04_dataprocessor/01_basic_init.html)
So if I put the (commented out) alert before the call to mygrid.getRowId() (or similar before a call to mygrid.forEachRow(function(rowID) { … } )), everything works fine and I get the row ID (1 for instance), otherwise it just says undefined and all tries of continuing with this value will fail naturally.
Am I doing something wrong or is the mistake somewhere else?
Thanks for your help.