Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted on Mar 07, 2007 11:15
open dhtmlx forum
I am dynamically creating a tree and adding nodes with script.  When the tree loads I only load the fir...

I am dynamically creating a tree and adding nodes with script.  When the tree loads I only load the first level and then as the user drills down I grab the needed data and fill in the tree.  Currently, if a node has sub-nodes I have to add a sub-node in order to get the little plus sign next to the root node to tell the user the root node has child nodes.  It would be optimal if I could just tell it to show the plus sign and then when the user clicks on the plus sign it fires the event to grab the data and fill in the tree.  I tried using the CHILD attribute but it didn’t seem to work.
Answer posted on Mar 07, 2007 11:16

If you don't use setXMLAutoLoading methods, child attribute is ignored.

By default setXMLAutoLoading will cause XML loading, but in your case it’s not necessary, so you can use setXMLAutoLoadingBehaviour(mode) method in "function" mode  which allows to call user function instead of xml.

For example:

  function my_func(id){

  ....any kind of logic here...

  //the return result doesn't matter

  //but you can add item for parent item here  } tree.setXMLAutoLoadingBehaviour("function");

tree.setXMLAutoLoading(my_func);

In such init "child" attribute will work, and onOpen it will call my_func.
Answer posted by Inga (Support) on Dec 08, 2014 00:21

Not much can be said in addition to the reply above, but you also can check php combobox and php ajax editable grid and find out what we have probably missed in our explanation.