Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Daniel on Oct 31, 2007 09:01
open dhtmlx forum
Object required error in IE 6 for the grid.cells() method

I am trying to access the cells in the grid object using the grid.cells() method. Here is the javascript code:

grid = new dhtmlXGridFromTable('tableName');
...
selRowId = grid.getSelectedId();

name = grid.cells(selRowId, 0).getValue();<--DIES HERE
unit = grid.cells(selRowId, 1).getValue();
phone = grid.cells(selRowId, 2).getValue();
email = grid.cells(selRowId, 3).getValue();
...

I am initiallizing the grid in HTML in a JSP. This method works fine in firefox, but does not work in IE. Here is some of the jsp:

<table id="tableName" border="1" width="100%" forceCellTypes="true">
<colgroup>
<col>
<col>
<col>
<col>
<col width="24">
<col width="24">
</colgroup>
//HEADER
<tr>        
    <td type="ro" sort="str"><div style="text-align:left; font-weight:bold">Name</div></td>
    <td type="ro" sort="str"><div style="text-align:left; font-weight:bold">Unit</div></td>
    <td type="ro" sort="str"><div style="text-align:center; font-weight:bold">Phone</div></td>
    <td type="link" sort="str"><div style="text-align:left; font-weight:bold">Email</div></td>
    <td type="img" sort="na"><div style="text-align:left; font-weight:bold">Actions</div></td>
    <td type="img" sort="na" style="font-size:.3em">#cspan</td>
</tr>
     ...THERE IS LOOP HERE THAT CREATES THE ROWS...
<tr>
    <td style="text-overflow:ellipsis; text-align:left;">VALUE</td>
    <td style="text-overflow:ellipsis; text-align:left;">VALUE</td>
    <td style="text-overflow:ellipsis; text-align:center;">VALUE</td>            
    <td style="text-overflow:ellipsis;text-align:left;">VALUE</td>
    <td valign=center align=center style="border-right-style:none;">IMAGE</td>
    <td valign=center align=center style="border-left-style:none;">IMAGE</td>
</tr>

Here is a clip from the windows debugger:

this.cells4 = function(cell){
if (!cell._cellType) <-- IT SAYS MY CODE DIES HERE
return eval("new eXcell_"+this.cellType[cell._cellIndex]+"(cell)");
else

Any help would be greatly appreciated.
Answer posted on Oct 31, 2007 11:34
Such error may occurs only if not existing column index used, but it seems pretty strange in described case , because index 0 must exist.
I'm not sure but it can be browser specific issue - please try to remove new lines between tr and td tags ( in some special cases it can be counted as HTML elements, and will be able to break correct functionality )
If problem still occurs for you - please send full sample code to support@dhtmlx.com