I am struggling with gridview checkbox in gridview yii2. For checkbox, I can use
'class' => 'kartik\grid\CheckboxColumn',
which is extends from
'class' => 'yii\grid\CheckboxColumn',
So, the complete code is in gridview :
GridView::widget([
'id' => 'crud-datatable',
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'pjax' => true,
'columns' => require(__DIR__ . '/_columns.php'),
Which is column.php is :
return [
[
'class' => 'yii\grid\CheckboxColumn',
'checkboxOptions' => function($model, $key, $index, $column) {
}
], ... /*bunch column here */
My question is, how can I checked this checkbox by pjax. Because I have a data that came from pjax like this :
$js = <<<JS
$(document).on('pjax:complete', function(data){
var datas = $('#print-sticker-keren').attr('data-print');
/* result e.g : 2297,2275,2321,2317,2315
I was wondering like function php's in_array.
*/
});
JS;
$this->registerJs($js);
Aucun commentaire:
Enregistrer un commentaire