I am using the cgridview to show my data. But I cannot type into the input text field and cannot select from the select/dropdown, these are the filter options on the cgridview. By the way, the data is from a view, not a from a regular table. I also tried on my other cgridview that uses a model from a table, but still it is not working. I cannot select or type into the filter fields.
Below are codes on my controller,
$request = new Request;
$request->unsetAttributes();
if(isset($_GET['Request'])
$request->attributes=$_GET['Request'];
$this->render('index', array(
'request' => $request,
));
Below are the safe fields on the model,
array('request_id, facility_id, client_id, status, description, submitted_by, submitted, acknowledge, req_type', 'safe')
Below are the codes on the model search method
function setRequests(){
$criteria = new CDbCriteria;
$criteria->compare('req_type',$this->req_type, true);
$criteria->compare('description', $this->description, true);
$criteria->compare('status', $this->status, true);
return new CActiveDataProvider($this, array(
'criteria' => $criteria,
'pagination'=>array('pageSize'=>5),
));
}
Below are the codes on the view file.
$this->widget('zii.widgets.grid.CGridView', array(
'id'=>'request-clist',
'dataProvider'=>$request->setRequests(),
'filter'=>$request,
'columns'=>
array(
array('name'=>'req_type',
'header'=>'Item',
'value'=>'CHtml::link($data->req_type, array($data->url));',
'type'=>'raw',
'filter' => CHtml::dropDownList('Request[req_type]',
$request->req_type,
array(
'Notice' => 'Notice',
'FAR' => 'FAR',
'PC' => 'PC',
'EM'=>'EM',
'RH'=>'RH'),
array('empty' => '(Select)'))
),
array('name'=>'description',
'header'=>'Description',
'filter'=>CHtml::textField('Request[description]',$request->description)),
array('name'=>'status',
'header'=>'Status',
'filter'=>CHtml::textField('Request[status]',$request->status)),
),
));
Are there some things I miss?