I have a gridview like code below
<?= GridView::widget([
'id' => 'table-penerimaan-produksi',
'dataProvider' => $dataProvider,
//'filterModel' => $searchModel,
'columns' => [
[
'class' => 'yii\grid\CheckboxColumn',
'checkboxOptions' =>
function($model) {
return ['value' => $model->id, 'class' => 'checkbox-row'];
}
],
'ref.id',
'ref.send_date',
'received_date',
'ref.vehicle_id',
['attribute' => 'netto', 'label' => 'Netto Terima', 'format' => ['decimal', 2]],
['attribute' => 'ref.netto', 'label' => 'Netto Kirim', 'format' => ['decimal', 2]],
['attribute' => 'susut', 'format' => ['decimal', 2]]
],
]); ?>
what i want is to calculate netto from selected row by using jquery. i have jquery like this:
$('.select-on-check-all, .checkbox-row').click(function(){
calculateNetto();
})
function calculateNetto()
{
var keys = $('#table-penerimaan-produksi').yiiGridView('getSelectedRows');
}
How to get the value from keys and post to controller to save the ids selected?
Thanks in advance.
Yii::$app->request->post().