Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Dolzer on Dec 07, 2009 08:58
open dhtmlx forum
DHTMLXGRID loadXML Question

Hi there,

i have a problem with an loadXML funtion.

When i load the XML i want to check it has succsessfully loaded.
After completing loading the XML there should be an output like: 1457 datasets found.

I solved it with an time at the moment.

Is there any other possibility to get an return value when the dataset it loaded?

i want to change that code:
setTimeout(setCounter, 500);

to something like that:
setTimeout(setCounter, loadXML('ajax_base.php?db=........'));


Thanks for your help.


that's my code now:



mygrid.loadXML("ajax_base.php?db=<?php echo $this->datenbank; ?>&tb=<?php echo $this->table; ?>");
showLoading();

function setCounter(){
    var span = document.getElementById("recfound");

    var AnzGefunden = <?php echo $rows; ?>;
    var TicketPlural = "Datasets";

    span.style.color = "green";
    if (AnzGefunden == 1) {
         TicketPlural = "Dataset";
    }
    pan.innerHTML = AnzGefunden + " " + TicketPlural + " gefunden";

    var MyAnzahl;

     MyAnzahl = <?php echo $rows; ?>;

}
function showLoading(){
     var span = document.getElementById("recfound")
    
    span.style.color = "red";
    span.innerHTML = "loading Datasets...";
            
    setTimeout(setCounter, 500);
            
}
Answer posted by dhxSupport on Dec 07, 2009 09:01
You can use 2nd parameter of loadXML method:
mygrid.loadXML(url,function(){
//rows where fully loaded
});