CTreeView how to retrieve the element clicked

I have a CTreeView, I want to do a different action according to the element has been clicked, but how can I intercept this event?

I see that CtreeView is a list with <UL> <LI> <LI>… So I think I should insert the event "onclick" foreach <LI>

but how can I do it in CTreeView?

In DropDownList I can specify in htmloptions differents options for example:

dropDownList ($name, $select, $data, $htmlOptions=array ( 



For CtreeView I tried this solution but it seems not possible.

Another solution should be insert the "onclick" in the UL tag and then according to the index clicked, with Javascript, do the right action, for example:


'htmlOptions'=>array('onclick'=>'if (indexclicked==xxxx)...')));

the problem is how can I understand wich index is clicked with javascript? For dropdownlist I can use

if (this.options[this.selectedIndex])=='xxxx' ...

there is a similar syntax for UL list?

I wrongly inserted this topic in russian Forum, I don’t know how to eliminate or move it.

I reinserted in it in "General Discussion for Yii 1.0.x"



don’t worry, we understand:) hello italy :)