Grid View

how can i create a grid view from a model displaying only records with the given ids?

When I understand your question correct you want to display not ALL but some specific records in a GridView?

Then You don’t have to modify the GridView.

Just create a DataProvider containing the model records you want.

DataProviders:

http://www.yiiframework.com/doc-2.0/guide-output-data-providers.html

Short Example (scroll to GridView):

http://www.yiiframework.com/doc-2.0/guide-output-data-widgets.html

Regards

thank you!

something like… in Yii1.1

$criteria = new CDbCriteria();

$criteria->addInCondition("id", array(6,7,8,9));

Just to avoid confusion:

As far as I know there is no CDbCriteria in YII 2 anymore.

You now use yii\db\Query or yii\db\ActiveQuery

See following topics for reference:

http://www.yiiframework.com/forum/index.php/topic/53749-where-is-cdbcriteria/

Regards

yes it was in Yii1.1