Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Ray on May 26, 2009 08:16
open dhtmlx forum
Refreshing Icons - Error MSG

I am trying to refresh the treegrid icons which worked and for some reason just stopped working.

My code is below.
treeGrid.updateFromXML("userxml.aspx", false, false, function(){
//Refresh the icons after a user has been enabled
treeGrid._h2.forEachChild(0, function(el) {
var cell = treeGrid.cells(el.id, data[1]);
cell.setImage(cell.getAttribute("image"));
});
})



I get the following error message "Microsoft JScript runtime error: 'childNodes' is null or not an object" at the below code location in dhtmlxgrid.js.

cells:function(row_id, col){
        if (arguments.length == 0)
            return this.cells4(this.cell);
        else
            var c = this.getRowById(row_id);
        var cell = (c._childIndexes ? c.childNodes[c._childIndexes[col]] : c.childNodes[col]);
        return this.cells4(cell);
Answer posted by Support on May 26, 2009 09:38
Such error can occurs in next situation
- non-unique IDs used in TreeGrid
- 0 was used as ID for some element
- incorrect cell index provided for cells command

The last one may be related to the next line
>>var cell = treeGrid.cells(el.id, data[1]);
be sure that data[1] - is a valid index value
Answer posted by Ray on May 26, 2009 10:50
I just commented out the jquery library and it works as it should. Have you have experience using the jquery library with dhtmlx?
Answer posted by Alex (support) on May 27, 2009 05:14

Hello, 

it seems that jquery doesn't redefine anything. So, it can't cause such a problem. 

You can provide a complete that allows to re-create the issue. We'll try to help.  

Answer posted by Ray on May 27, 2009 05:24
I found the issue. The issue is when the treegrid is not fully expanded and I try to perform a call, I get a null or object expected error msg. When I have the treegrid fully expanded, it works as it should. How do I correct this?
Answer posted by dhxSupport on May 27, 2009 06:03
Such issue occurs because of while performing some methods expected object is not loaded yet. You should wait till treeGrid fully expanded.