hello all,
I have problem regarding displaying data via CGridView. I want to display records that meet certain condition. This condition is a fixed, so for example I have table like this
Product
===========
id
name
price
stock
category_id
I would like to show all records that the category_id value is 10. Where do I define the property? I ever try to do like this. But it doesn’t work
<?php
$model = Inventory::model();
$model->category_id=10;
$dataProvider = new CActiveDataProvider(get_class($model));
$this->widget('zii.widgets.grid.CGridView', array(
'id'=>'inventory-grid',
'filter'=> $model,
'dataProvider'=>$dataProvider,
'columns'=>array(
'id',
'name',
'price',
)
)
); ?>
Any idea ?