ostovar, on 02 July 2011 - 02:38 AM, said:
CTreeView won't display when i add createLinks() function
my CTreeView works great with out urls
how can i add url for each nodes??
I have just write something about this. you can find solution here
Posted 08 July 2011 - 04:05 AM
hav3fun, on 30 May 2011 - 09:32 AM, said:
public function actionTree(){
if (!Yii::app()->request->isAjaxRequest) {
exit();
}
$parentId = "NULL";
if (isset($_GET['root']) && $_GET['root'] !== 'source') {
$parentId = (int) $_GET['root'];
}
$sql = "SELECT m1.id, m1.title AS text, m2.id IS NOT NULL AS hasChildren,m1.url "
. "FROM menu AS m1 LEFT JOIN menu AS m2 ON m1.id=m2.id_parent "
. "WHERE m1.id_parent <=> $parentId "
. "GROUP BY m1.id ORDER BY m1.position ASC";
$req = Yii::app()->db->createCommand($sql);
$children = $req->queryAll();
$children = $this->createLinks($children);
echo str_replace(
'"hasChildren":"0"',
'"hasChildren":false',
CTreeView::saveDataAsJson($children)
);
exit();
}
<?php
$this->widget(
'CTreeView',
array(
'animated'=>'fast', //quick animation
'collapsed' => true,
'url' => array('/site/tree'),
)
);
?>
Quote
<=> $parentId
This post has been edited by Hermans: 08 July 2011 - 04:11 AM
Posted 09 July 2011 - 11:06 AM
Hermans, on 08 July 2011 - 04:05 AM, said:
<=> $parentId
Quote
Posted 09 July 2011 - 11:15 AM
Posted 10 July 2011 - 09:00 AM
This post has been edited by macinville: 14 July 2011 - 10:13 AM
Posted 11 July 2011 - 04:57 AM
bingjie2680, on 08 July 2011 - 03:14 AM, said:
Posted 13 July 2011 - 12:02 PM