I have a controller as following:
public function actionAjaxFillTree($parentId){
if (!Yii::app()->request->isAjaxRequest) {
exit();
}
$sql = "SELECT m1.id, m1.title AS text, m2.id IS NOT NULL AS hasChildren,m1.url,m1.icon,m1.tooltip,m1.options "
. "FROM menu_adjacency AS m1 LEFT JOIN menu_adjacency AS m2 ON m1.id=m2.parent_id "
. "WHERE m1.parent_id <=> $parentId "
. "GROUP BY m1.id ORDER BY m1.position ASC";
$req = Yii::app()->db->createCommand($sql);
$children = $req->queryAll();
echo str_replace(
'"hasChildren":"0"',
'"hasChildren":false',
CTreeView::saveDataAsJson($children)
);
exit();
}
and a view.
I want to fransfer a variable from view to controller.
<?php
echo "jdfkhgkfd";
$this->widget(
'CTreeView',
array(
'animated'=>'fast', //quick animation
'collapsed' => true,
'url' => array('/site/ajaxFillTree','$parentId'=>3),
)
);
?>
it does’nt work.
How could i do?
Someone help me!
Thanks you