A
A
andruxin2014-04-25 16:44:34
Yii
andruxin, 2014-04-25 16:44:34

Yii. How to make a custom filter in CGridView?

How to make the filter according to the data different in structure from the model?
dataProvider - receives data using the Purchase::getInfoAllUser() function.
Normally filter is equal to $model , but in this case the fields of the model are not equal to the fields to be displayed (some calculations are done before the output). What exactly needs to be fed in filter ?

$this->widget('zii.widgets.grid.CGridView', array(
    'dataProvider' => Purchase::getInfoAllUser(),
    'filter' => ??????,
    'columns' => array(
            array('name' => 'id', 'filter' => false),
            array('name' => 'user', 'filter' => Purchase::getInfoAllUser()),
            array('name' => 'summary_cost', 'filter' => false),
        )
));

Answer the question

In order to leave comments, you need to log in

1 answer(s)
_
_ _, 2014-04-25
@AMar4enko

You need to edit Purchase::getInfoAllUser, set up a filter in the code there.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question