Render_sql modifies statement and adds [column] = '0'

When trying to fill a tree using render_sql I noticed in log file that the sql command I use is modified and it’s looking for an item with value equal to 0

Original SQL

select id,node,parentnode,displaytext,visible,tagdata from v_useractions where groupid = 1 and parentnode=110 and visible<>0 and tagdata like 'sa%'

Then it’s somehow modified, I suppose by the connector to:

SELECT  id,node,parentnode,displaytext,visible,tagdata FROM v_useractions WHERE ( groupid = 1 and parentnode=110 and visible<>0 and tagdata like 'sa%') AND `parentnode` = '0'

Of course this command returns nothing and the tree doesn’t load data.

My data is like this:

  ID ,NODE, PARENTNODE, DISPLAYTEXT
  78,    110,                50,         Tree Entries
 456,   1000,              110,         Entry 1
 123,   1010,              110,         Entry 2
 947,   1020,              110,         Entry 3

Why is it trying to get an entry with a value equal to 0 and how can I bypass that? All I want is to load the entries with the same PARENTNODE in a tree without having any root item to expand.

Please, specify: do you mean TreeGrid?

Not treegrid, I am trying to work with dhtmlxTree

Hello,

Tree always has root node. Root id is defined in the 4th parameter of the dhtmlXTreeObject constructor. The following means that root will have 0 id:

tree=new dhtmlXTreeObject(“treeDiv”,“100%”,“100%”,0);

Tree connector renders tree structure for 0 id as a root by default.

If your tree has a root node with different id, for example root id is 1000, you should pass this id as a parameter to connector script:

tree=new dhtmlXTreeObject(“treeDiv”,“100%”,“100%”,1000);

tree.loadXML(“01_basic_connector.php?id=1000”);

If the root structure is already loaded and you need to load some other branch, you need to pass its id too:

tree.loadXML(“01_basic_connector.php?id=someId”);

Thanks a lot, will try that