How To Enable Filter In Particular Field

My model is, as follows:

<?php

$this->breadcrumbs = array(

'Manage',

);

?>

<h1>Manage Projects</h1>

<?php

$this->widget(‘bootstrap.widgets.BootGridView’, array(

'id' =&gt; 'project-grid',


'dataProvider' =&gt; &#036;model-&gt;search(),


'filter'=&gt;&#036;model,


'columns' =&gt; array(


    array('header' =&gt; 'Name',


        'value' =&gt; '&#036;data-&gt;client-&gt;firstname.&quot; &quot;.&#036;data-&gt;client-&gt;lastname'),


    array('header' =&gt; 'picture',


        'type' =&gt; 'raw',


        'value' =&gt; '&#036;data-&gt;getProjectPicture(&#036;data-&gt;id)'),


    array('header'=&gt;'Status','name' =&gt; 'is_approved',


        'type' =&gt; 'raw',


        'value' =&gt; '&#036;data-&gt;is_approved == 1 ? &quot;Approved&quot; : CHtml::ajaxLink(&quot;Not Approved&quot;, array(&quot;approve&quot;, &quot;id&quot; =&gt; &#036;data-&gt;id), array(&quot;success&quot; =&gt; &quot;approve(&#036;data-&gt;id)&quot;), array(&quot;id&quot; =&gt; &quot;approve_&quot; . &#036;data-&gt;id))'


    ),


    array('name' =&gt; 'date',


        'value' =&gt; 'date(&quot;Y/m/d&quot;, strtotime(&#036;data-&gt;date))'),


    array('header' =&gt; 'Managed By',


        'value' =&gt; '&#036;data-&gt;getAdvisor(&#036;data-&gt;id)'),    


    /*








      'project_status',


     */


    array(


        'class' =&gt; 'BootButtonColumn',


        'template' =&gt; '{view}{delete}',


    ),


),

));

?>

<script type="text/javascript">

function approve(id){


    &#036;(&quot;#approve_&quot;+id).text(&quot;Approved&quot;).replaceWith(&#036;(&quot;a#approve_&quot;+id).text());


}

</script>

All the fields have sorting function, except in the column, name and picture, How do I enable that.?

Hi,

i think you can use the


'sort'=>array(

        'attributes'=>array(

             'id', 'name', 'picture',

        ),

    ),



more refrence

http://www.yiiframework.com/doc/api/1.1/CArrayDataProvider

Sorry, That did not solve my problem. Here, I came to realize one thing, is, all other fields come from same table, but, the Name come from another table, so filter model does not work. So, There should be anotheer solution. I guess

Hi,

if record display the filter in another table…you can use some thing lookl like this…

you can write a cutome query on filter


array(

                'name'=>'user_id',

                'value'=>'GxHtml::valueEx($data->user,\'fullname\')',

                'filter'=>GxHtml::listDataEx(User::model()->findAll('user_type=\'venue\''), 'id', 'fullname'),

),

Note: i hope your model reolation are proper

I am new to YII, Can you explain the above code, what is ValueEx, listataEx and so

it did not work though for me.