Hi,
I am using the dhtmlxgrid component and have a function that hides rows from the grid dinamically.
I want also to hide the plus sign of the parent rows, when there are no more children to display under them.
I’ve read the following post:
dhtmlx.com/docs/products/kb/ … yes&s=hide sign
…and you suggested to execute these two lines:
grid.setCellExcellType(row_id,column_index,“ro”);//change type
grid.cells(row_id,column_index).setValue(""); //set empty value
However, when executing the first one (setCellExcellType), i get the following JS error:
“row is undefined”
File: […]/scripts2/dhtmlxgrid.js
Line: 195
And the row actually exists, because if i skip that line and execute the other one (setValue), the content of the cell becomes empty.
However, the plus sign and the folder image do not dissapear from the cell. Only the “content” is removed.
I’d appreciate your help on this.
FYI: the version we are using is dhtmlxTreeGrid_pro_v15_71114.zip.
Thanks!
Fernando.-
This issue occurs when “row_id” doesn’t exist. Please check if you pass correct row id to the setCellExcellType method.
In grid 1.5 each row must have “tree” type excell to maintain hierarchy ( its actual for later version as well, but not such important ) so changing column type from “tree” to different one maybe not safe for grid 1.5
The article in question related to “subgrid” mode of plain grid, and not related to TreeGrid.
The next code line must change the visual appearance of item , without any side effects
grid._h2.change(row_id,“state”,“blank”);
grid._updateTGRState(grid._h2.get[row_id]);
The row id is correct, since i can work properly with it in different ways.
As for the second answer you gave me (to use the commands “h2.change” & “updateTGRState”), i applied it, but i get following error:
z is undefined
[…]/dhtmlxtreegrid.js
Line 51
So, i was thinking on using a “manual” solution for hiding the plus sign. This is, by using the “style.display” attribute of the image.
To do this, i would need to get the cell TD where the sign is placed so i can then use the “getElementBy” command to find the image within it.
Can you please tell me how to get the TD object from a grid cell?
For example, from this one: “mygrid.cells2(1,5)”.
Thanks in advance.
Fernando
mygrid.cells2(1,5).cell - will point to the TD element
mygrid.cells2(1,5).cell.parentNode.imgTag - if row was rendered - points to the IMG tag ( which renders “plus” or “minus” states )
>>z is undefined
and again, such error can occur only if row with such ID doens’t exist