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

Showing default column search datatable


how to show default search field in datatable,

I tried this method, but it doesn't appear


$("#table").dataTable({
"searching": true
});


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 (4)


Hi Jatinika.

Are you using the HTML version?

The default search DOM has been removed by default for the Metronic custom layout. You can check this file and look for the default DOM modification. You can remove this code block to make the datatable use the default DOM with the search input.

src/js/vendors/plugins/datatables.init.js


$.extend( true, DataTable.defaults, {
dom:
"<"table-responsive"tr>" +

"<"row"" +
"<"col-sm-12 col-md-5 d-flex align-items-center justify-content-center justify-content-md-start"li>" +
"<"col-sm-12 col-md-7 d-flex align-items-center justify-content-center justify-content-md-end"p>" +
">",

renderer: "bootstrap"
} );


Thanks



I did remove this block of code on datatables.init.js but the search bar is still not showing up. Is there anything else I need to do? I am using Metronic v8.1.7.


$("myTable").DataTable({
"searching": true
});



Were you able to show the search bar after following @Faizal's reply?


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  :(