php - How to define custom lable in gridview filled by ArrayDataProvider? -


i'm getting data using webservice in json format , want dispaly them using gridview. use arraydataprovider send data gridview using code:

$dataprovider = new arraydataprovider([    'allmodels' => $data,    'pagination' => [        'pagesize' => 10,     ],     'sort' => [        'attributes' => ['fname', 'lname', 'age', 'email'],     ], ]); 

how can change label of columns in grid? example first name instead of fname?

thank you.

i found answer url https://github.com/yiisoft/yii2/issues/11490

add new property arraydataprovider::modelclass manually specify model arraydataprovider must use generate column labels. change allow arraydataprovider correctly generate column labels using model::getattributelabel() method when provided data array empty.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -