อ่านมังงะสนุกขึ้น แค่มีสคริปต์จิ้มภาพแล้วเลื่อนจอ
ผมเคยอ่านมาทั้ง 2 แบบ แล้วรู้สึกว่า การกดที่รูปภาพแล้วม […]
เอาโค้ดตัวเต็มไปตัดต่อเอาเองเน้อ แต่หลักๆ คือใช้ Event […]
ปรับปรุงล่าสุด 01/09/2563
เอาโค้ดตัวเต็มไปตัดต่อเอาเองเน้อ แต่หลักๆ คือใช้ Event drawCallback ของตัว DataTables นะ
let dataTables = $('#datatable').DataTable({
ajax: {
url: backofficeUrl + "manage/youtube/get_items",
type: 'POST',
data: {}
},
columns: [{
data: 'id',
},
{
data: 'name',
visible: false,
},
],
columnDefs: [{
targets: 0,
className: 'text-center',
render: function(data, type, full, meta) {
return data;
},
},
{
targets: 1,
className: 'align-top',
render: function(data, type, full, meta) {
return data;
}
},
],
drawCallback: function(settings) {
var api = this.api();
const isAdmin = true;
// ถ้า isAdmin เป็น true จะแสดง column ที่ 1 ออกมา
if (isAdmin) api.column(2).visible(true);
}
});