How to NOT show the node icon at all?

We’re using TreeGrid with a tree in the first column, and other data in subsequent columns. We have the tree lines turned on, and are using the little [+] and [-] icons for the expansion/collapse symbols. That is all well and good. However, the customer does not want the little “page” icon (that is, leaf.gif) to show - they want no icon there at all, but rather, the node lable begin at that point.

So, the tree would look something like this (this example is using ASCII, but in reality we’re using the icon graphics):

  [-]--+--- Node 1                                  [-]--+-- # Node 1
   |   |----- Node 1.1             Instead of:       |   |---- # Node 1.1
   |   +----- Node 1.2                               |   +---- # Node 1.2
   +------- Node 2                                   +------ # Node 2

Is there a way to turn this off in the TreeGrid? The Tree object seems to have a method to do this, but I cannot find one for the TreeGrid. If I try to call the Tree object’s method from the TreeGrid object, I get errors (it does not exist).

In terms of OOP, is TreeGrid not derived from Tree & Grid as base classes? It appears that is the case… unless I’m missing something.


You can’t redefine rendering of tree-item, but you can alter image

  • use blank.gif for all items
  • add

As result images will not be visible

Ah! Thanks, Stanislav. That works great. In my case, I took your idea and made a 5x18 gif that had the dashed line across the middle to “extend” the horizontal line just enough to make the vertical line of the child node come out under the first character of the parent node’s label. Then, of course, I set the grid.setImageSize(5,18). Looks great.

Thanks again.

Is there a way to set the icon in the xml?

Ah, actually I found it. In the xml just set the cell attribute, making sure the path is correct since it’s wanting to go automatically to the dhtmlxGrid/codebase/imgs folder. So you can either come up out of that folder and direct it to another or add your own icon to that folder to use just the file name.

<cell image="../../../../images/date.gif"></cell>
<cell image="date.gif"></cell>