Hello,
I have to load big structures into dhtmlxtree and they are created dynamically from a SQL-Database by the dhtmlxconnector. The latest structure has about 2500 Elements and still growing. I takes about 20 sec. and more, until the three is loaded, only the creation of the xml-source took 12 sec. Has somebody experience working with large dynamic structures?
Thank you very much for your help!
Best regards Philipp
For such big count of elements - dyn. loading is the best solution.
Check
samples\tree\02_dynamic_loading.html
samples\tree\02_dynamic_loading_connector.php
inside the connector’s package
Sorry, it´s not working:( I have the following code…
$this->setUserStartId($this->user->getStartNode($this->user->getUserId($this->user->Name),“idtm_struktur”));
$this->DBConnection = new TDbConnection($this->Application->getModule(‘db1’)->database->getConnectionString(),$this->Application->getModule(‘db1’)->database->getUsername(),$this->Application->getModule(‘db1’)->database->getPassword());
$this->DBConnection->Active = true;
$res=mysql_connect($this->Application->Parameters[‘Host’],$this->Application->getModule(‘db1’)->database->getUsername(),$this->Application->getModule(‘db1’)->database->getPassword());
mysql_select_db($this->Application->Parameters[‘Database’]);
$tree = new TreeConnector($this->DBConnection);
$tree->enable_log(“temp.log”,false);
$tree->dynamic_loading(true);
$mySQL = “SELECT idtm_struktur,struktur_name,idta_struktur_type,parent_idtm_struktur FROM tm_struktur”;
$mySQLOrderBy = " ORDER BY idta_struktur_type, struktur_name";
$this->load_all_cats($mySQL.$mySQLOrderBy);
//the start ID
$mySQLcond1 = “idtm_struktur IN (” . $this->subCategory_list($this->subcats, $this->UserStartId) . “,”. $this->parentCategory_list($this->parentcats, $this->UserStartId) .")";
function custom_format($item){
$item->set_image(“str”.$item->get_value(“idta_struktur_type”).".gif");
}
$tree->event->attach(“beforeRender”,custom_format);
$SQLComp = $mySQL." WHERE ".$mySQLcond1.$mySQLOrderBy;
//print_r($SQLComp);
$tree->render_sql($SQLComp,“idtm_struktur”,“struktur_name”,“parent_idtm_struktur”);
Maybe it´s because of the render_sql statement?