Note that there are some explanatory texts on larger screens.

plurals
  1. POYii Advanced and inline search via alias
    primarykey
    data
    text
    <p>I have several models with relations and what I am trying to do is to search the fields with the aliases I provide in DetailView. It looks like this</p> <pre class="lang-php prettyprint-override"><code>&lt;?php $this-&gt;widget('bootstrap.widgets.BootGridView',array( 'id'=&gt;'operations-grid', 'dataProvider'=&gt;$model-&gt;search(), 'filter'=&gt;$model, 'columns'=&gt;array( 'operationType.name:raw:Operation', 'creation_date:datetime', 'modification_date:datetime', 'ammount_usd:raw:Ammount', 'currency.short', /* 'client_id', 'organization_id', */ array( 'class'=&gt;'bootstrap.widgets.BootButtonColumn', ), ), )); ?&gt; </code></pre> <p>And what I want is to be able to search through rows using the aliases for columns like <code>currency.short</code>. What is a correct approach to do that? Tried to modify the <code>search()</code> method like this..but I think I'm missing something.</p> <pre class="lang-php prettyprint-override"><code>public function search() { // Warning: Please modify the following code to remove attributes that // should not be searched. $criteria=new CDbCriteria; $criteria-&gt;compare('creation_date',$this-&gt;creation_date,true); $criteria-&gt;compare('modification_date',$this-&gt;modification_date,true); $criteria-&gt;compare('ammount',$this-&gt;ammount,true); $criteria-&gt;compare('ammount_usd',$this-&gt;ammount_usd,true); $criteria-&gt;compare('currency_id',$this-&gt;currency_id); $criteria-&gt;compare('operation_type',operationType::model()-&gt;name); $criteria-&gt;compare('client_id',$this-&gt;client_id); $criteria-&gt;compare('organization_id',$this-&gt;organization_id); $criteria-&gt;compare('comment',$this-&gt;comment); return new CActiveDataProvider($this, array( 'criteria'=&gt;$criteria, )); } </code></pre> <p>Thanks.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload