I have an array of data very similar to this
[
    'name'=>'mark',
    'age'=> '21'
    'height'=> '190 cm'
]
I searched Google and all the results i found were using an active record object.
How do i use the gridview with an array of this sort?
You should use ArrayDataProvider (https://github.com/yiisoft/yii2/blob/master/framework/data/ArrayDataProvider.php)
$provider = new ArrayDataProvider([
    'allModels' => $yourArray,
    'sort' => [
        'attributes' => ['id', 'username', 'email'],
    ],
    'pagination' => [
        'pageSize' => 10,
    ],
]);
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With