Super Sale Limited Time 50% OFF for All-Access Plans
Save 50% Now

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>

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
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • 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
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(