Column filtering on URL query string

Column filtering on URL query string

danstauntondanstaunton Posts: 6Questions: 0Answers: 0
edited January 2014 in DataTables 1.9
Hi,

Can someone help me with automatically filtering a column from a URL query string.

At the moment I can set the value of my column filter to value in my URL. However I have to hit return or type in a space in the column filter in order for it to return rows matching my filter.

http://79.174.222.26:8080/dashboard/portal.php?ref=23456

In the above example I want my data in column 0 to automatically filter values containing 23456 in them automatically.

Would appreciate any help.

Thanks

Replies

  • danstauntondanstaunton Posts: 6Questions: 0Answers: 0
    Can anyone help?
    Thanks
  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    Use fnFilter and base it on the `window.location.search` property.

    Allan
  • danstauntondanstaunton Posts: 6Questions: 0Answers: 0
    Hi Allan,

    Is it possible to automatically populate an input box with this filter? The reason why I would like it in this box is so when my user wants to clear the filter all they need to do is remove the text from this box.

    This is the example I am working off:
    http://datatables.net/release-datatables/examples/api/multi_filter.html

    Thank you
  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    Sure - get the search term from `location.search` and just put it into the search box using jQuery.

    Allan
This discussion has been closed.