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

How do I pass search parameter in query string with KTDatatable?


I am trying to apply filter on the remote datatable with KTDatatable.

It is metronic 9.x

I do not see any documentation where I could pass all filter criteria with the apiEndpoint URL.

I have referred the documentation located at https://keenthemes.com/metronic/tailwind/docs/components/datatable


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


Have anyone found any hint on this?
I have tried Faizals solution but filter keep track of old state for some reason making filters an array of many objects



Hi

You can try using the setFilter function. Pass your column and search value like this:


const dataTable = KTDatatable instance;
dataTable.setFilter({
column: "id",
type: "text",
value: "x value",
}).redraw();


Assuming, you are using Laravel as your backend, you may refer to this example backend service code to handle all the datatable parameters.

https://gist.github.com/faizalmy/8ed91fe4b83d5f9c807d7a81309ff680



I want to know the same... have some filters like the search input, role user, etc and i do not find any documentation...


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