zii.widgets.grid.CGridView

If a database column with a default value is included, then this value is always displayed in the search inputs and only results with that default value will be displayed in the item list and its impossible to conduct a search, eg:




<?php $this->widget('zii.widgets.grid.CGridView', array(

	'id'=>'category-grid',

	'dataProvider'=>$model->search(),

	'filter'=>$model,

	'columns'=>array(

		'id',

		'category_name',

		'sort_order',    //  <<< this column has a default database value of zero

		array(

			'class'=>'CButtonColumn',

		),

	),

)); ?>



Any solution to this?

svan note that the original post is from the year 2010, and this "problem" has been discussed few more times on the forum…

you need to use unsetAttributes() - http://www.yiiframework.com/doc/api/1.1/CModel#unsetAttributes-detail