Ctreeview Doesn't Use Htmloptions In Data

Simple way to reproduce

When creating tree for a CTreeView I’m doing a for whit this insidee




$outChildren[] = array('id' => $childData->companyChildId."_companyChildId",

                                   

                                  'text' => $text, 

                                  'hasChildren' => true,

                                  'htmlOptions' => array(

                                          'class' => 'trapForBug',

                                          'data-role' => 'anotherTrap',

                                   ),

                   

                                  );




When rendered, the UL has not the class setted, and has not the ‘data-role’ attribute setted.

I see in documentation that CTreeView has htmlOptions for itself, but inside the data is possible to set htmlOptions for every item.

Follow a tipical json data which NOT render the htmlOptions in the leaf




[

{"id":"3_companyChildId",

 "text":"Terza azienda",

 "hasChildren":true,

 "htmlOptions":{"class":"trapForBug","data-role":"anotherTrap"}

}, 

.... 

]



You can not use htmlOptions in treeview async ajax calls. Only the ‘classes’ of the leaf can be specified in the json response:




[

{"id":"3_companyChildId",

 "text":"Terza azienda",

 "hasChildren":true,

 "classes":"trapForBug"

}, 

.... 

]



Optionally you can modify the framework/web/js/source/jquery.treeview.async.js script to process other leaf attributes or even htmlOptions.

Thanks for reply, but I cannot understand why it’s in the documentation if it’s not an available option !

Any update on this ?

Even I feel it is a bug, since they did not mention that it won’t work for async ajax calls