Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Fernando D'Agostino on Feb 06, 2009 10:54
open dhtmlx forum
dhtmlxgrid - hiding plus sign when no child

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:
http://www.dhtmlx.com/docs/products/kb/index.shtml?cat=search&page=1&q=4800&ssr=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.-
Answer posted by dhxSupport on Feb 09, 2009 07:42
This issue occurs when "row_id" doesn't exist. Please check if you pass correct row id to the setCellExcellType method. 
Answer posted by Alex (support) on Feb 10, 2009 10:40
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]);



Answer posted by Fernando D'Agostino on Feb 17, 2009 10:16

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
http://devhq.ssrn.com//Conference/scripts2/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

 

Answer posted by Support on Feb 18, 2009 08:40
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