Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by James Snyder on Aug 10, 2009 10:14
open dhtmlx forum
getValue error: childIndexes is null or not an object

I am running into an error that I thought wasn't happening before.

The grid is setup as:
grdItems = new dhtmlXGridObject('grdItems_Container');
grdItems.setImagePath("../../images/grid_images/");
grdItems.imgURL = "../images/grid_images/";
grdItems.setHeader(",,");
grdItems.setNoHeader(true);
grdItems.enableColSpan(true);
grdItems.setInitWidths("200,150,20");
grdItems.setColAlign("left,right,right");
grdItems.setColTypes("ro,ro,ro");
grdItems.enableEditEvents(true);
grdItems.attachEvent("onCheckbox",addCost);
grdItems.init();

When I check off one of the checkboxes "addCosts" runs (as it should) and here is that code:
(The error is happening before the second alert)
function addCost(iRow,iCell,bState){
var iID=0;
var iRowCount = grdItems.getRowsNum();
    
for(var r=0; r<iRowCount; r++){
    iID = grdItems.getRowId(r);
    if (iID = iRow){
        iRow = (r+1);
        break;
    }
}

alert('1')
    //var sCost=grdItems.cells(iRow,1).getValue().toString();
    //var sCost=grdItems.cells(1,1).getValue() //.toString();
    //var sCost=grdItems.cells(0,0).getText() //.toString(); //childindexes
    //var sCost=grdItems.cells(1,0).getText()
    var sCost=grdItems.cells(0,1).getText()
alert('2 cost:'+sCost)
    sCost = sCost.replace("add $","");
    if (bState){
        mmItemPrice = (parseFloat(mmItemPrice) + parseFloat(sCost));
        calcQty();
    }
    else{
        mmItemPrice = (parseFloat(mmItemPrice) - parseFloat(sCost));
        calcQty();
    }

}


I attempted several different methods, but they all return the same "childIndexes is null or not an object" from the dhtmlgrid.js file, line 5685

Any thoughts?

Thanks for your time.
James

Answer posted by Support on Aug 11, 2009 10:08
>>var sCost=grdItems.cells(0,1).getText() 

This is mean "second cell in the row with ID = 0" - is it correct?
If you need a first row, it will be 
         var sCost=grdItems.cells2(0,1).getText() 
If you need the same row , where checkbox was checked 
         var sCost=grdItems.cells(iRow,1).getText() 

>>"childIndexes is null or not an object"
This error occurs when non-existing ID or Index was used in API command.