Get 2024 Templates Mega Bundle!14 Bootstrap, Vue & React Templates + 3 Vector Sets
Get for 99$

Enable searching on Grouped Datatable


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;
}
});
}



});


No option i try will enable the search box to appear??

Any help would be great.

Thanks
Paul


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (1)


Hi,

May I know your Metronic version? Have you tried to use the row grouping example as per the theme docs here?

Regards.


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(