Ok. You can do it in multiple ways. This is one of them:
[list=1]
[*]move the part of the code in your #infra to a partial view.
[*]use a new separate controller action that takes the id as argument to render that partial view.
[*]call that new action in your ajax call passing the clicked id to it
[/list]
Something along these lines (not tested, so I hope you can work out the errors if there are):
[list=1]
[*]your current view becomes
foreach($exe as $row)
{
echo CHtml::ajaxLink($row['category_name']."(".$row['ttl'].")",
array('yourController/yourNewMethod'),
array(
'update'=>'#infra',
'data'=>array('ids'=>$row['category_id']),
'type'=>'GET',
)
).' return false; }'
));
echo "<br>";
}[
<div id="infra">
<?php $this->renderPartial('_yourPartialView', array('ids' => null)); ?>
</div>
[*]in yourController.php
public function actionYourNewMethod($ids)
{
if (!Yii::app()->request->isAjaxRequest || ($ids == null)) {
Yii::app()->end;
}
echo $this->renderPartial('_yourPartialView', array('ids' => $ids));
}
[*]_yourPartialView.php
if($ids == null) //show item from all category first time
{
$dataProvider=new CActiveDataProvider('Infrastruktur',array(
'criteria'=>array(
'order'=>'urutan asc',
),
'pagination'=>array(
'pageSize'=>4,
),
));
$this->widget('zii.widgets.CListView', array(
'dataProvider'=>$dataProvider,
'itemView'=>'//infrastruktur/_view',
'template'=>'{pager}{items}',
'pager'=>array(
'maxButtonCount'=>'3',
'nextPageLabel'=>'>',
'prevPageLabel'=>'<',
'header'=>'',
'cssFile'=>Yii::app()->baseUrl.'/css/pager.css',
),
'summaryText'=>'',
'emptyText'=>'',
));
}
else //show item from clicked category
{
$dataProvider=new CActiveDataProvider('Infrastruktur',array(
'criteria'=>array(
'order'=>'first_update desc',
'condition'=>'category_id = '.$ids,
),
'pagination'=>array(
'pageSize'=>4,
//'route'=>'user/login/login',
),
));
$this->widget('zii.widgets.CListView', array(
'dataProvider'=>$dataProvider,
'itemView'=>'_view',
'template'=>'{pager}{items}',
'pager'=>array(
'maxButtonCount'=>'3',
'nextPageLabel'=>'>',
'prevPageLabel'=>'<',
'header'=>'',
'cssFile'=>Yii::app()->baseUrl.'/css/pager.css',
),
'summaryText'=>'',
'emptyText'=>'',
));
}
[/list]