Hi guys, following attempt deleting records using CheckBoxColumn in GridView fails. I have no idea, why?!Following code in Controller:
var_dump(Yii::$app->request->post('selection'));
var_dump($checkbox);
die();
will show this:
NULL
array(0){}
Here is code of GridView:
<?=
Html::beginForm(['/dateianhang/dateianhang/all', "RenderBackInCaseOfError" => $RenderBackInCaseOfError, "FKBezeichnung" => $FKBezeichnung, 'fk' => $id], 'post', ['name' => 'idAnhang']);
?>
<p>
<?= Html::submitButton(Yii::t('app', 'Records löschen'), ['<span class="glyphicon glyphicon-trash"></span>', 'class' => 'btn btn-danger', 'title' => 'Records löschen', 'name' => 'button_checkBoxes']); ?>
</p>
<?php
$gridColumn = [
[
'class' => '\kartik\grid\CheckboxColumn', 'checkboxOptions' => function($model) {
return ['value' => $model->id];
},
],
.
.
[size=2]];[/size]
?><?=
Html::endForm();
Here is code of Controller:
public function actionAll($RenderBackInCaseOfError, $fk = NULL, $FKBezeichnung = NULL) {
try {
$session = new Session();
$checkbox = (array) Yii::$app->request->post('selection');
var_dump(Yii::$app->request->post('selection'));
var_dump($checkbox);
die();
foreach ($checkbox as $item) {
$this->actionDel($item, $RenderBackInCaseOfError);
}