i have code to build datatable with child datatable, and i use codeigniter to build my project, but it always error as this
var KTDatatableChildRemoteDataDemo = function() {
var demo = function() {
var datatable = $('.kt-datatable').KTDatatable({
data: {
type: 'remote',
source: {
read: {
url: '<?= base_url($c_name . 'listdata') ?>',
},
},
serverPaging: true,
serverSorting: true,
},
detail: {
title: 'Load sub table',
content: subTableInit,
},
columns: [{
field: 'ID',
title: '',
},
{
field: 'FULL_NAME',
title: 'Full Name',
}],
});
function subTableInit(e) {
$('<div/>').attr('id', 'child_data_ajax_' + e.data.ID).appendTo(e.detailCell).KTDatatable({
data: {
type: 'remote',
source: {
read: {
url: '<?= base_url($c_name . 'listUniversity') ?>',
method: 'post',
params: {
ID: e.data.ID,
},
},
},
serverPaging: true,
serverSorting: true,
},
columns: [{
field: 'UNIVERSITY',
title: 'University',
width: 100,
}, {
field: 'YEAR',
title: 'Year',
}],
});
}
};
return {
init: function() {
demo();
},
};
}();
jQuery(document).ready(function() {
KTDatatableChildRemoteDataDemo.init();
});
the error is undefined ID in
$('<div/>').attr('id', 'child_data_ajax_' + e.data.ID).appendTo(e.detailCell)
and then i print var e with console.log(e) and the output is Cannot read property 'ID' of undefined
so how to solve this error?