SirSalute
(Acetequila)
December 20, 2016, 5:57pm
1
Guys i want to edit the button "create" in header of yii2 gridview, but i cant find where is the function of that button. Another buttons i can change, like buttons of ActionColumn, {update}, {view} and {delete}, but the create button i cant find it.
tri
(tri - Tommy Riboe)
December 20, 2016, 6:25pm
2
Did you use Gii to generate CRUD. Then it’s not part of the gridview.
It’s a normal link in the view. E.g at line 22 in @app /views/<controller>/index.php.
SirSalute
(Acetequila)
December 20, 2016, 6:31pm
3
yes, i use gii to generate Crud.
kenjisoul
(Xuyuan8)
December 21, 2016, 4:49am
4
Hope this code and this
http://www.bsourcecode.com/yiiframework2/gridview-in-yiiframework-2-0/ can help you.
[
'class' => 'yii\grid\ActionColumn',
'template' => '{view} {update} {delete}',
'urlCreator' => function ($action, $model, $key, $index) {
if ($action === 'view') {
$url = '<action>?<parameter>=<value>';
return $url;
}
if ($action === 'update') {
$url = '<action>?<parameter>=<value>';
return $url;
}
if ($action === 'delete') {
$url = Url::to(['<action>?<parameter>=<value>']);
return $url;
}
}]