If I have an array of object want to show in CGridView

If I already has array of object which want to show up in CGridView, what should I do?

such as

array([0] => Post Object, [1] => Post Object, [2] => Post Object)

I want to use that list to show up in my CGridView. I cannot find CGridView properties to set specific list of objects.

Try reading about CArrayDataProvider.

OK, finally I use it as below…




 $dataProvider=new CActiveDataProvider('Messages');

 $dataProvider->data = $results; // $results is an array of Messages objects.

 $this->render('success',array('dataProvider'=>$dataProvider,));