How can I pass a search word in a hyperlink to datatable & have it sort onload with the serach word?

How can I pass a search word in a hyperlink to datatable & have it sort onload with the serach word?

wilgus2wilgus2 Posts: 2Questions: 1Answers: 0

Link to test case:
Debugger code (debug.datatables.net):
Error messages shown:
Description of problem:

Answers

  • kthorngrenkthorngren Posts: 21,174Questions: 26Answers: 4,923

    You can use search.search to define a search term used when the Datatable initializes.

    Kevin

  • wilgus2wilgus2 Posts: 2Questions: 1Answers: 0

    I need to be able to send the search word via link from another page. The table has multiple rows, with multiple form types. IE. Public, State ext. Rather than create multiple tables, I want the table to sort on load with the users choice, using a link on other pages. I hope I an explaining myself clearly.

  • kthorngrenkthorngren Posts: 21,174Questions: 26Answers: 4,923
    edited February 2021

    Use your favorite Javascript techniques to parse the URL parameters. You can use variables to dynamically build the Datatable initialization options. Here is a simple example of using a variable with search.search:
    http://live.datatables.net/xaxavini/1/edit

    EDIT: Or maybe you are using the ajax option and want to send a parameter to the server to refine the results retrieved. For this you can use ajax.data.

    If this isn't what you want please provide a link ot a running test case that represents your solution more closely with a description of the process you want.

    Kevin

This discussion has been closed.