dixonsatit / yii2-actioncolumn
Yii2 ajax delete for action column
Installs: 65
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 1
Open Issues: 0
Type:yii2-extension
Requires
- yiisoft/yii2: *
This package is auto-updated.
Last update: 2024-11-05 11:17:08 UTC
README
Yii2 ajax delete for action column
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist dixonsatit/yii2-actioncolumn "*"
or add
"dixonsatit/yii2-actioncolumn": "*"
to the require section of your composer.json
file.
Usage
Once the extension is installed, simply use it in your code by :
<?php Pjax::begin(['id'=>'pjax-id']); ?> <?= GridView::widget([ 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [ // ..... [ 'class' => 'dixonsatit\actioncolumn\ActionColumn', 'pjaxId'=>'pjax-id' ] ], ]); ?> <?php Pjax::end(); ?>
in controller change actionDelete()
to
public function actionDelete($id)
{
$this->findModel($id)->delete();
//return $this->redirect(['index']);
}