How Do I Get Raw Array Out Of $Dataprovider

Hi guys,

I am using a jqGrid extension and in ‘options’ => array(‘data’ => $rawArray) it requires apparently a raw array. However the dataProvider or $model->search(), $model->findAll() returns an object.

Is there any way to retrieve a raw data for the jgGrid extension or do I really have to iterate to create a raw array?

Or does the jqGrid extension accept the dataProvider somehow?

All I see in jqGrid extension is ‘options’ => array(‘url’=>’/path/to/grid.json’,… ).

you can use CArrayDataProvider instead of CActiveDataProvider in your action or in your model’s search() method

You don’t need a dataProvider for the jqGrid, only for CGridView, CListView…

Use the [url="http://www.yiiframework.com/doc/guide/1.1/en/database.dao"]CommandBuilder and $command->queryAll().

[/url]

If you need a dataProvider with array data you can use:

CArrayDataProvider or CSqlDataProvider

You CJson:encode() your data.

Thanks guys, that helped.