I'm incrementing a count for an item in a jQgrid. I'm showing a popup window where it prints a list with al the items and how many of these items. How do I foreach these items in a table?
jQuery:
let scannedCount = {};
function checkedFormatter(cellValue, row) {
scannedCount[row.rowId] = 0;
return '<div class="d-flex align-items-center justify-content-between checkCell" style="font-size: 1.8rem;">' +
'<i class="fas fa-minus minCheck" style="cursor: pointer;" onclick="decrementCount(' + row.rowId + ')"></i> ' +
'<input class="scannedCount-' + row.rowId + '" type="text" value="' + scannedCount[row.rowId] + '" style="width: 70px;">' +
'<i class="fas fa-plus plusCheck" style="cursor: pointer;" onclick="incrementCount(' + row.rowId + ')"></i></div>'
}
function incrementCount(rowId) {
scannedCount[rowId]++;
$("#scannedCount-" + rowId).val(scannedCount[rowId]);
console.log(scannedCount);
}
function shoppingCart(id) {
openAddModal({
type: 'shopping-cart',
title: Lang.get('strings.shopping-cart'),
url: '/' + id + '/shopping-cart/',
});
}
shoppingcart:
<div class="packing-slip">
<table class="packing-table">
<thead>
<tr>
<th class="table-head" style="text-align: left;">{{__('description')}}</th>
<th class="table-head">{{__('amount')}}</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
<script>
{{$shoppingCart}} = scannedCount;
</script>
Do I append each row or something? I can't get it to work. Can someone please help me?
Thanks