Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Michiel Betel on Mar 20, 2008 08:06
open dhtmlx forum
printView on grid with loadXML not working

Using dhtmlxgrid pro v.1.5 build 71114

When I do a printView on a grid which has data loaded via an url using loadXML I only see the headers. The normal grid using exactly the same code is generated and rendered as correct html. When I use loadXMLString to load the data it works fine.

eg. This shows headers and data:

var mygrid = new dhtmlXGridObject('printreport');
..
..
mygrid.init();
mygrid.loadXMLString('{/literal}{$cXMLReport}{literal}');
mygrid.printView();

And this does only shows the headers but not the grid data:

var mygrid = new dhtmlXGridObject('printreport');
..
..
mygrid.init();
mygrid.loadXML('du.php?lijst=1&toon_x=1&contract='+contract);
mygrid.printView();

Why???

Thanks,

Michiel

Answer posted by Support on Mar 20, 2008 08:44
The XML loading is async, so the command next to loadXML will be executed in moment when data not really loaded yet.
You need to catch moment when data will be loaded from server - it can be done by onXLE event or by using second parameter of loadXML

mygrid.loadXML('du.php?lijst=1&toon_x=1&contract='+contract,function(){
    mygrid.printView();
});