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.
Quote
data property
public array $data;
the data that can be used to generate the tree view content. Each array element corresponds to a tree view node with the following structure:
text: string, required, the HTML text associated with this node.
expanded: boolean, optional, whether the tree view node is expanded.
id: string, optional, the ID identifying the node. This is used in dynamic loading of tree view (see url).
hasChildren: boolean, optional, defaults to false, whether clicking on this node should trigger dynamic loading of more tree view nodes from server. The url property must be set in order to make this effective.
children: array, optional, child nodes of this node.
htmlOptions: array, additional HTML attributes (see CHtml::tag). This option has been available since version 1.1.7.
Note, anything enclosed between the beginWidget and endWidget calls will also be treated as tree view content, which appends to the content generated from this data.
public array $data;
the data that can be used to generate the tree view content. Each array element corresponds to a tree view node with the following structure:
text: string, required, the HTML text associated with this node.
expanded: boolean, optional, whether the tree view node is expanded.
id: string, optional, the ID identifying the node. This is used in dynamic loading of tree view (see url).
hasChildren: boolean, optional, defaults to false, whether clicking on this node should trigger dynamic loading of more tree view nodes from server. The url property must be set in order to make this effective.
children: array, optional, child nodes of this node.
htmlOptions: array, additional HTML attributes (see CHtml::tag). This option has been available since version 1.1.7.
Note, anything enclosed between the beginWidget and endWidget calls will also be treated as tree view content, which appends to the content generated from this data.
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"}
},
....
]

Help













