Accessing grid afterLoad

Hi anyone,

I’m using dhtmlX grid 3.5.0 pro version.
I need to access my grid after load xml, on order to count rows, or to enable/disable checkbox.
On all browers (IE9, Firefox, Chrome) my grid in still empty …

i used :

<html>
<link rel="STYLESHEET" type="text/css" href="http://localhost:8080/hrf00Web/dhtmlx/dhtmlxGrid/codebase/dhtmlxgrid.css">
<link rel="stylesheet" type="text/css" href="http://localhost:8080/hrf00Web/dhtmlx/dhtmlxGrid/codebase/skins/dhtmlxgrid_dhx_skyblue.css">
	<body>
<script  src="http://localhost:8080/hrf00Web/dhtmlx/dhtmlxGrid/codebase/dhtmlxcommon.js"></script>
<script  src="http://localhost:8080/hrf00Web/dhtmlx/dhtmlxGrid/codebase/dhtmlxgrid.js"></script>
<script  src="http://localhost:8080/hrf00Web/dhtmlx/dhtmlxGrid/codebase/dhtmlxgridcell.js"></script>    
 
 
 
<div id="gridbox" style="width:600px; height:270px; background-color:white;"></div>
<a href='#alfa' onClick="afterRefresh()">Count rows grid</a>

</a>	
<script>
var mygrid = new dhtmlXGridObject('gridbox');
mygrid = new dhtmlXGridObject('gridbox');
mygrid.setImagePath("http://localhost:8080/hrf00Web/dhtmlx/dhtmlxGrid/codebase/imgs/");
mygrid.setHeader("Sales,edtxt,ed,Price,In Store,Shipping,Bestseller,Date of Publication");
mygrid.setInitWidths("50,150,100,80,80,80,80,200");
mygrid.setColAlign("right,left,left,right,center,left,center,center");
mygrid.setColTypes("dyn,edtxt,ed,price,ch,co,ra,ro");
mygrid.setColSorting("int,str,str,int,str,str,str,date");
mygrid.init();
mygrid.setSkin("dhx_skyblue");
mygrid.enableAlterCss("even", "uneven");
mygrid.load("http://www.dhtmlx.com/docs/products/dhtmlxGrid/samples/common/gridH.xml",afterRefresh());
function afterRefresh(){
	alert(mygrid.getRowsNum());
}
</script>
	</body>
</html>

The RowsNum() after refresh is always 0.
But when click link count rows, i have the good result.
I really need to access the grid after load XML in order to check or uncheck my checkboxes based on another grid.
Thanks in advance.

Ric.

Replying to myself :wink:

I have to add function(){…} in load method, even if my function is already defined.

mygrid.load("http://www.dhtmlx.com/docs/products/dhtmlxGrid/samples/common/gridH.xml",function(){afterRefresh();});

And it works fine :smiley: