how to fix addrow datatables?
how to fix addrow datatables?
**https://stackoverflow.com/questions/65711698/how-to-fix-add-row-datatables**:
**
// jquery
$('.addrowedit').click(function(){
var tableBomEdit = $('#tbl-edit').DataTable({
"bDestroy": true,
paging:false
});
var counter = tableBomEdit.rows().count();
var itung = Number(counter)+1;
document.getElementById('jmlh_row_edit').value = itung;
var frmCode = "frm_code_edit"+itung;
var partNo = "part_no_detail_edit"+itung;
var Descript = 'descript_detail_edit'+itung;
var Unit = 'unit_edit'+itung;
var Qty = 'qty_child_edit'+itung;
var QtyNG = 'qty_ng_child_edit'+itung;
var WH = 'warehouse_edit'+itung;
var dtatable = tableBomEdit.row.add([
"<input type='text' readonly name='frm_code[]' id="+frmCode+" class='form-control form-control-sm'>",
"<input type='text' readonly name='part_no_detail[]' id="+partNo+" class='form-control form-control-sm'>",
"<input type='text' readonly name='descript_detail[]' id="+Descript+" class='form-control form-control-sm'>",
"<input type='text' readonly name='unit[]' id="+Unit+" class='form-control form-control-sm'>",
"<input type='text' readonly name='quantity[]' id="+Qty+" class='form-control form-control-sm'>",
"<input type='text' readonly name='qty_ng[]' value='0' id="+QtyNG+" class='form-control form-control-sm' readonly>",
"<input type='text' readonly id="+WH+" value='90' class='form-control form-control-sm' readonly>"
]).draw(false);
});
//html
Item Code | Part No | Description | Unit | Qty | Qty NG | Warehouse |
---|
</div>
<div class="modal-footer">
<button type="button" class="btn btn-info " data-dismiss="modal">Close</button>
<button type='button' id="btn-remove-edit" class='btn btn-info removerowEd'>Delete</button>
<button type="button" id="btn-addrow-edit" class="btn btn-info addrowedit">Add Item</button>
<button type="button" class="btn btn-info update" ><i class="ti-check"></i> Save</button>
</form>
<input type="hidden" id="jmlh_row_edit" value="">
how to fix it .. So, when I press the addrowedit button, the row increases, but why is it always on top, I want it to always be below ... how do I do it?, help me please friend i already try searching solution in google, but i am not find, sorry my english bad:
Answers
The table ordering will determine where the new row is displayed. One option is to use the Absolute position plugin to place the new row where you like.
Kevin
are there any examples ?, almost the same as my specific case
This example from this thread may help - it's showing how to use the Absolute plugin,
Colin