Tree Lines & other TreeGrid modifications "on the fly"

Hello again -

I am trying to create a small mockup for my supervisors, and want to present several different ways of creating a treegrid.

When I am defining my treeGrid, I call mygrid.enableTreeGridLines(); before the mygrid.init() call, which successfully draws the tree lines.

Later, after the init, I call mygrid.enableAlterCss(“row”,“row”,true,true); which for my 6-level tree very nicely makes each successive level a slightly deeper color (deeper level == deeper color) based on some carefully chosen color tags for row_0, row_1, etc.

So far, so good.

At the end, I have a set of buttons (links) where I attempt to change aspects of the grid, such as turn the lines on/off, switch to different AlterCss schemes, etc. In the code below, only the expandAll() and collapseAll() calls work. The rest do not.

    <table id="button_bar" width='940'>
        <tr width='100%>
            <td><a href="javascript:void(0)" onclick="mygrid.expandAll();">Expand All</a></td>
            <td><a href="javascript:void(0)" onclick="mygrid.collapseAll();">Collapse All</a></td>
            <td><a href="javascript:void(0)" onclick="{bLinesOn = !bLinesOn; mygrid.enableTreeGridLines(bLinesOn);}">Lines</a></td>
            <td><a href="javascript:void(0)" onclick="mygrid.enableAlterCss('', '', false, false);">Plain White</a></td>
            <td><a href="javascript:void(0)" onclick="mygrid.enableAlterCss('row_0', 'row_1', false, false);">Alt. Rows</a></td>
            <td><a href="javascript:void(0)" onclick="mygrid.enableAlterCss('row_0', 'row_1', true, false);">Alt. Levels</a></td>
            <td><a href="javascript:void(0)" onclick="mygrid.enableAlterCss('row', 'row', true, true);">The Deep</a></td>
            <td width='30%'>&nbsp;</td>

I’m using FF 3.6.3 on a Windows XP SP3 platform.
Any ideas, anyone? Can these calls be made once the grid is loaded and “running”?


Love the product, BTW.

Can these calls be made once the grid is loaded and “running”?
There is no way to turn on\off treeGrid lines and alter css dynamically. If you really need it you should destruct treeGrid and initialize it again with necessary configuration.
You can destruct treeGrid with destructor() method … destructor

OK, thanks Olga. I’ll give that a shot.

Hi Olga -

Your suggestion works - for the most part. It appears there may be a bug in the dhtmlxTreeGrid_lines.js file - or I’m still not doing something correctly.

My understanding is that, to use the enableTreeGridLines, I have to include the above js file. However, it seems that it is simply sufficient to include it to get the lines - I don’t have to call the enableTreeGridLines function. However, if I DON’T want the lines, I cannot include the js file.

Here’s the problem: In practice, we will be using the compiled dhtmlx.js file, which has everything compiled into it - including dhtmlxTreeGrid_lines.js - and therefore there is no way to have a tree without lines in that scenario. Simply not calling the enable function, or calling it with a “false” passed in does not work.

Could this be an issue with the tree grid lines code, or am I not understanding it correctly? Ignore the previous bit about changing it on the fly - even the first creation of the treegrid is affected the same way.


Simply not calling the enable function, or calling it with a “false” passed in does not work.
This issue confirmed and will be fixed at the next version of dhtmlxTreeGrid. If don’t want treeGrid lines you should not call enableTreeGridLines() method

Thanks Olga.

That’s fine, but the real problem is that simply including the dhtmlxtreegrid_lines.js file in the list of included JS files is sufficient to cause the lines to be drawn. I don’t have to actually call the method at all. Because this file is compiled into the dhtmlx.js file, all tree grids will have lines (that is the manner in which we include the product files in our application).

Just wanted you to be aware of that scenario. As it turns out, I just got word from my boss that the customer wants the lines in, so I’m off the hook (for now :slight_smile: )

I don’t have to actually call the method at all.
Yes, this was an issue. Now if dhtmlxtreegrid_lines.js or dhtmlx.js files are included and enableTreeGridLines() is not called TreeGrid lines will not be rendered.
If you need fixes immediately you can open ticket at and we will send you fixed files.

Cool! Thanks, Olga.