Hi guys, I’ve a little problem with checkboxes in gredview
This is my code
[
'class' => 'yii\grid\ActionColumn',
'template' => '{check}',
'buttons' => [
'check' => function ($url, $data, $column) use ($campaign_id, $list_checked) {
$input = '<input type="checkbox"
class="campaign-checkbox"
id="campaign_' . $data->product_id . '"
value="'. $campaign_id . ' ' . $data->product_id . '"
data-index = "'. $column .'"';
if (in_array($data->product_id, $list_checked))
{
$input .= 'checked';
}
$input .= '>';
return $input;
},
],
],
js for my code
$(document).ready(function() {
$('.campaign-checkbox').on('click', function(event) {
$.ajax ({
url: 'check',
type: 'POST',
dataType: 'html',
cache: false,
data: { data1 : $(this).val() },
});
if (this.checked) {
$(this).parent().parent().addClass('success');
}
else {
$(this).parent().parent().removeClass('success');
}
})
});
this is work for me, but I would like to use this
[
'class' => 'yii\grid\CheckboxColumn',
// you may configure additional properties here
],
My question is, how can I set properties (id, value, class) for CheckbocColumn ? Is there some way to do that?