I’ve made a CListView update which works fine. The code is:
public function actionFilterItems()
{
$criteria = new CDbCriteria;
if (isset($_POST['gender']) && !empty($_POST['gender'])) {
$criteria->addInCondition('gender', CJSON::decode($_POST['gender'], false));
}
$criteria->order = 'itemBasePrice ASC';
$dataProvider = new CActiveDataProvider(inShopItem::model()->active(), array(
'criteria'=>$criteria,
'pagination' => array (
'pageSize' => Yii::app()->user->getState('pageSize', 20),
),
));
$this->render('index',array(
'dataProvider'=>$dataProvider,
));
}
I make an update every time a filter checkbox is checked|unchecked. But I want to refresh filter values for every new set of listed items, like colour, brand and so on. How can I pass additional data back to view to rearrange filters? I’ve tried $this->colour so that to access it in the view, but its value remains unchanged.
I wonder why $this doesn’t work? And that is not the first time I can’t access $this in the view, rendered by controller, where $this was populated with some value;
Would much appreciate any help.