Hi…
Im trying to add a filter to a tdbGridView but i get the following message when filtering after y fill a filter with some data: "Creating default object from empty value".
I was wondering what action does filtering execute that is not instanciating my model correctly??? Im thinking that is the problem but i havent found where the error could be
this is the code on my view
$this->widget('ext.bootstrap.widgets.TbGridView', array(
'dataProvider' => $dataProvider,
'type' => 'striped hover condensed',
'filter' => $productsAdminRest,
'columns' => array(
array(
'name' => 'restaurant_id',
'htmlOptions' => array('width' => '40px'),
//'filter' => CHtml::textField('ProductAdminRest[restaurant_id]'),
'filter' =>'',
),
array(
'name' => 'id',
'htmlOptions' => array('width' => '40px'),
'filter' => '',
),
array(
'name' => 'category_id',
'value' => '$data->category->name',
'filter' => CHtml::dropDownList('ProductAdminRest[category_id]', $_GET['Product']['category_id'], CHtml::listData(Category::model()->findAll('t.restaurant_id in( ' . $rid. ') and not (parent_id is null)'), 'restaurant_id','id', 'name', 'pname'), array('prompt' => '', 'encode' => false)),
),
array(
'name' => 'name',
'value' => '$data->name',
'filter' => CHtml::textField('Productx[sname]'),
),
array(
'name' => 'price',
'value' => 'Yii::app()->numberFormatter->formatCurrency($data->price, Yii::app()->params->currency)',
'htmlOptions' => array('width' => '80px'),
),
array(
'name' => 'code',
'value' => '$data->code',
'htmlOptions' => array('width' => '80px'),
),
/*array(
'name' => 'code',
//'value' => '$data->code',
'value'=>'CHTML::textField($data->code,"dfd",array(\'width\'=>20,\'maxlength\'=>3))',
'htmlOptions' => array('width' => '80px'),
'filter' => CHtml::textField('ProductAdminRest[scode]'),
),*/
/*array(
'header'=>'Codigo',
'value'=>'CHTML::textField($data->code,$data->code,array(\'width\'=>20,\'maxlength\'=>3))',
'type'=>'raw',
'htmlOptions'=>array('width'=>'20px'),
), */
array(
'name' => 'active',
'value' => 'Yii::t("main", $data->active?"active":"inactive")',
'filter' => array(Yii::t('main', 'inactive'), Yii::t('main', 'active')),
'htmlOptions' => array('width' => '70px'),
),
array(
'class' => 'ext.bootstrap.widgets.TbButtonColumn',
'template' => '{update}',
'buttons' => array(
'update' => array(
'url'=>'Yii::app()->createUrl("productAdminRest/update", array("id"=>$data->id, "restaurant_id"=>$data->restaurant_id) )',
//'url' => 'array("update", array("id"=>$data->id, "restaurant_id"=>$data->restaurant_id))',
),
),
),
),
));
Other models filter perfectly fine. I dont understand why filtering this model is giving me this exception
Thanks in adnvance