In my controller:
$model = new Sheets();
$criteria = new CDbCriteria;
$criteria->compare('id', $model->id);
$criteria->compare('track_name', $model->track_name, true);
$criteria->addCondition('user_id = '.Yii::app()->user->getId().' and '.$listSetups[$i]['condition']);
$setups = new CActiveDataProvider($model, array('criteria' => $criteria));
In my view:
<?php $this->widget('zii.widgets.grid.CGridView', array(
'id' => 'sheets-grid',
'dataProvider' => $model,
//'filter' => $model,
'template'=>'{items}<div class="nav-controller">{pager}</div>',
'enableSorting' => false,
'columns' => array(
array(
'header' => 'Track',
'name' => 'track_name',
'value' => $model->track_name,
'htmlOptions' => array(
'width' => '135px',
),
),
But I get this error:
Error:Property "CActiveDataProvider.track_name" is not defined.
Anybody can show me why is this? And how can i fix it.And I don't want to use $data->track_name
because I want to use $model->track_name in this code to customize button 'Add' :
array(
'header' => '',
'class' => 'CButtonColumn',
'template' => '<div class="wrapper-tools">{share}{facebook}{twitter}{download}{add}{update}{delete2}</div>',
'buttons'=>array (
'add' => array
(
'label'=>'Add favorite',
'imageUrl'=> (Users::model()->checkFavorite(Yii::app()->user->getId(), $model->track_name)) ? Yii::app()->themeManager->baseUrl."/default/images/favorite.png" : Yii::app()->themeManager->baseUrl."/default/images/favorite-disabled.png",
'url'=>'Yii::app()->createUrl("/sheets/", array("id"=>$data->id))',
'options' => array('id' => 'add-favorite', 'class' => 'admin-tools' ),
//'visible' => 'Users::model()->checkFavorite(Yii::app()->user->getId(), $data->id) == false',
),
),
'htmlOptions' => array(
'class' => 'admin-tools-2',
),
)
Thanks