Hi yii fans,
I have categories that are order using the nested set behavior. When I use an ajaxLink:
echo CHtml::ajaxLink($category->name,'category/returnSideView', array('update' => '#sideview', 'type' => 'POST','data'=>$category->id));
in a simple list view, my #sideview div is updated.
But when I display the categories in a jsTree view (the ajaxLink are created in the category model), nothing happens especially no action call and no errors …
here’s model function :
public static function printULTree(){
$categories=Category::model()->findAll(array('order'=>'root,lft'));
$level=0;
foreach($categories as $n=>$category)
{
if($category->level==$level)
echo CHtml::closeTag('li')."\n";
else if($category->level>$level)
echo CHtml::openTag('ul')."\n";
else
{
echo CHtml::closeTag('li')."\n";
for($i=$level-$category->level;$i;$i--)
{
echo CHtml::closeTag('ul')."\n";
echo CHtml::closeTag('li')."\n";
}
}
echo CHtml::openTag('li',array('id'=>'node_'.$category->id,'rel'=>$category->name));
//echo CHtml::openTag('a',array('href'=>'#'));
echo CHtml::ajaxLink($category->name,'category/returnSideView', array('update' => '#sideview', 'type' => 'POST','data'=>$category->id));
//echo CHtml::encode($category->name);
//echo CHtml::closeTag('a');
$level=$category->level;
}
for($i=$level;$i;$i--)
{
echo CHtml::closeTag('li')."\n";
echo CHtml::closeTag('ul')."\n";
}
}