Good morning everybody, I’m struggling to list related records, for example, registration of a design has the User who registered (user table), the listing of projects is listing the user code, would like to list the user name and column filter user, I would like a textfield where he researches the name or part of the username, the same advanced searching, I’m trying some ways, but without success.
...$this->widget('zii.widgets.grid.CGridView', array( 'id'=>'project-category-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array( array( 'value'=>'CHtml::checkBox("id",null,array("value"=>$data->id,"id"=>"id".$data->id))', 'type'=>'raw', 'htmlOptions'=>array('width'=>5), ), array( 'name'=>'id', 'htmlOptions'=>array('width'=>20), ), array( 'name'=> 'user.username', 'value' => User::model()->findByPk($model->user_id)->username ),...
So up pops the username in the listing, but the filter field vanishes.
array( 'name'=> 'user_id', 'value' => User::model()->findByPk($model->user_id)->username ),
Thus the filter appears, but the listing displays the user id’s also the filter considers the id and not user name, a different thing to filter by user_id = 2 it goes to show user names in the list.
Anyone have any ideas?