70 lines
2.3 KiB
JavaScript
70 lines
2.3 KiB
JavaScript
|
|
datatableMasterMcu.bootstrapTable({
|
|
url: "/dashboard/datatable/mcu",
|
|
showColumns: true,
|
|
showColumnsToggleAll: true,
|
|
showRefresh: true,
|
|
sortable: true,
|
|
search: true,
|
|
searchOnEnterKey: false,
|
|
searchHighlight: true,
|
|
pagination: true,
|
|
serverSide: true,
|
|
pageSize: 10,
|
|
pageList: [10, 20, 30, 40, 50, 100, 200],
|
|
cookie: true,
|
|
icons: {
|
|
refresh: "fas fa-sync-alt", // atau ganti ke icon lain
|
|
columns: "fas fa-th-large"
|
|
},
|
|
|
|
columns: [
|
|
{
|
|
title: "Action",
|
|
field: 'menu_mcu_id',
|
|
formatter: function(value, row) {
|
|
let buttons = ''
|
|
buttons += `
|
|
<button class="btn btn-sm btn-primary me-2" onclick="editMasterMcu(this)" data-menu_mcu_id="${row.menu_mcu_id}"
|
|
data-nama_mcu="${row?.nama_mcu}"
|
|
data-harga="${row?.harga}"
|
|
>
|
|
<i class="fa-solid fa-pencil"></i>
|
|
</button>
|
|
`
|
|
console.log(row);
|
|
|
|
buttons += `
|
|
<button class="btn btn-sm btn-danger me-2" onclick="deleteMasterMcu(this)"
|
|
data-menu_mcu_id="${row.menu_mcu_id}"
|
|
data-nama="${row?.nama_mcu}"
|
|
>
|
|
<i class="fa-solid fa-trash"></i>
|
|
</button>
|
|
`
|
|
return `
|
|
<div class="d-flex space-x">
|
|
${buttons}
|
|
</div>
|
|
`;
|
|
},
|
|
width: 120
|
|
},
|
|
{
|
|
title:"Nama MCU",
|
|
field:"nama_mcu",
|
|
width: 300
|
|
},
|
|
{
|
|
title:"Harga",
|
|
field:"menu_mcu_id",
|
|
formatter: function(value, row) {
|
|
return `${row?.harga ? `
|
|
Rp ${parseInt(row.harga).toLocaleString('id-ID')}` : ``}`
|
|
},
|
|
width: 200
|
|
},
|
|
|
|
]
|
|
});
|