I have an API endpoint which will give a response json when queried.
Here is the response object:
[
{
"number": 1,
"name": "ABC"
},
{
"number": 2,
"name": "DEF"
},
]
I want to show it in the GridView but I don't know how to do it, because I'm not sure how to call push the json data (coming from API) in a data provider.
Below is the part where the grid loads
$this->widget('ext.jgridview.JGridView', array(
'id' => $id,
'dataProvider' => $model->search(),
'filter' => $model,
'ajaxUpdate' => isset($dependency)||isset($relation)?true:false,
'enablePagination' => true,
'template' => '{pager} {items} {pager}', // '{summary} {items} {pager}',
'type' => 'striped bordered condensed',
'summaryText' => true,
'summaryText' => Yii::t('app', 'Displaying {start}-{end} of {count} results.'),
'columns' => $columns,
'pager' => array(
'class' => 'booster.widgets.TbPager',
'displayFirstAndLast' => true,
'alignment' => TbPager::ALIGNMENT_CENTER,
'maxButtonCount' => Yii::app()->params['pagerMaxButtonCount'],
'prevPageLabel' => '<',
'nextPageLabel' => '>',
'firstPageLabel' => '<<',
'lastPageLabel' => '>>',
),
'selectableRows' => null,
));
Data provider in model-> search() looks like this
return new CActiveDataProvider($this, array(
'criteria' => $criteria,
'sort' => array(
'attributes' => array(
'*',
),
),
'pagination' => $pageSize<1000 ? array('pageSize' => $pageSize) : false,
));
What are the changes required to achieve the aforementioned?? Any example code which is targeted for Yii version 1.1 would help.