Extracting data from CActiveDataProvider

I’m trying to extract the data from my CActiveDataProvider to put into a JQuery grid but I can’t seem to figure out how to do that. Here is my feeble attempt:

$data = $model->search();

foreach($data->getData() as $d){

	$script .= 'var mydata = [ 


	]; ';




after your code to see your error.

You will need to try something similar to this.

$dataProvider = $model->search();

$list = array();

foreach($dataProvider->getData() as $model){

	$list[] = '{prop_id:"'.$model->prop_id.'"}';


$script = 'var mydata = [' . implode(',',$list) . ']; ';

Awesome! Worked perfectly. Thanks a lot.