Hi all,
I have a page with a datatable on that is grouped. Im struggling to enable the search and export facility that is on a datatable.
It can be done as per the link here <a>https://datatables.net/extensions/rowgroup/examples/initialisation/simple.html</a>
The code i am using is from the documented section on Metronic 8, which is what I am using.
var groupColumn = 0;
var table = $("#kt_datatable_row_grouping").DataTable({
"columnDefs": [{
"visible": false,
"targets": groupColumn
}],
fixedHeader: true,
search: true,
info: true,
responsive: true,
"order": [
[groupColumn, "asc"]
],
"displayLength": 1000,
"drawCallback": function(settings) {
var api = this.api();
var rows = api.rows({
page: "current"
}).nodes();
var last = null;
api.column(groupColumn, {
page: "current"
}).data().each(function(group, i) {
if (last !== group) {
$(rows).eq(i).before(
"<tr class=\"group fs-5 fw-bolder\"><td colspan=\"6\">" + group + "</td></tr>"
);
last = group;
}
});
}
});
Hi,
May I know your Metronic version? Have you tried to use the row grouping example as per the theme docs here?
Regards.