i could highlight the node that related page :
public function actionAjaxFillTree() {
// accept only AJAX request (comment this when debugging)
if (!Yii::app()->request->isAjaxRequest) {
exit();
}
$node = $_GET[id];
// parse the user input
$parentId = Yii::app()->user->id;
if (isset($_GET['root']) && $_GET['root'] !== 'source') {
$parentId = (int) $_GET['root'];
}
// read the data (this could be in a model)
$children = Yii::app()->db->createCommand(
"SELECT m1.id, m1.username AS text, m2.id IS NOT NULL AS hasChildren "
. "FROM psh_users AS m1 LEFT JOIN psh_users AS m2 ON m1.id=m2.parent_id "
. "WHERE m1.parent_id <=> $parentId "
. "GROUP BY m1.id ORDER BY m1.username ASC"
)->queryAll();
$treedata = array();
foreach ($children as $child) {
$options = ($child['id'] == $node)? array('href' => '#', 'id' => $child['id'], 'class' => 'treenode selected_node'):
array('href' => '#', 'id' => $child['id'], 'class' => 'treenode');
$nodeText = CHtml::openTag('a', $options);
$nodeText.= $child['text'];
$nodeText.= CHtml::closeTag('a') . "\n";
$child['text'] = $nodeText;
$treedata[] = $child;
}
echo str_replace(
'"hasChildren":"0"', '"hasChildren":false', CTreeView::saveDataAsJson(**$treedata**)
);
}