How to show Search Result

How to show Search Result

companellacompanella Posts: 1Questions: 0Answers: 0
edited November 2011 in General
Hi, thank you so much for great plugin.

I've set up a table (database) of people from all over the country and by clicking a link designating a state like "California" I want it to run search with prefixed term (included in the table).

So I am trying to establish something like a link that gives a search result (with a given search value/term).

Thank you so much in advance!

Moog

Replies

  • allanallan Posts: 63,535Questions: 1Answers: 10,475 Site admin
    I do something exactly like this in the DataTables reference: http://datatables.net/ref#search (note that "search" is put into the filter box).

    "View source" to see the how it works, but this is the key part:

    [code]
    var search = "";
    if ( window.location.hash !== "" ) {
    search = window.location.hash.substring( 1 );
    }

    var oTable = $('#reference').dataTable( {
    ...
    "oSearch": { "sSearch": search },
    ...
    [/code]

    Allan
This discussion has been closed.