jquery datatables select search

jquery datatables select search

slayerkingslayerking Posts: 4Questions: 0Answers: 0
edited February 2014 in General
I am using jquery datatables in my application but the search ignores the html select tag value.I am able to search using the value of input tag though.

How can i extend the datatables to also search for the select tag ?
Here is a jsfiddle http://jsfiddle.net/hBa3a/ when I search for gecko It doesn't filter the value

Replies

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395
    I don't understand what you expect to achieve with the HTML select tags. Also, nothing in your code supports the use of text input fields in table cells.
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    DataTables will automatically strip the HTML tags from the search (since you don't want the input 'p' to match `...` etc).

    Currently, there isn't a built in way to search on live DOM data such as getting the value from a select list I'm sorry to say. The live DOM sorting sort of does it ( http://datatables.net/release-datatables/examples/plug-ins/dom_sort.html ), but I think I'd need to spend some time developing an identical solution for filtering. Its on my to-do list, but a little way off.

    Allan
  • slayerkingslayerking Posts: 4Questions: 0Answers: 0
    edited February 2014
    Hello,
    Thanks for your reply..
    Tangerine I just made it for demo.. Sorry It's not the full code right there..
    I am using the fields right there to make the row editable and there's a additional column with a save button. So, that way i don't need a separate edit page.. That's the whole idea :)

    And Allan ,
    It does support filtering from [code] [/code] right ?

    Like in my fiddle when I search for [quote]Win 98[/quote] It does filter the correct record

    Is there something like

    [code]
    $('#example').dataTable({
    "sPaginationType": "full_numbers",
    beforeSearch: function (keyword, cell_value) {
    return $(cell_value).val() == keyword
    }
    });
    [/code]
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Yes and no. Yes it works in 1.9.4 - no it shouldn't. That is a bug in DataTables 1.9.4 (and only that version) where it doesn't stripy he HTML from the filtered data.

    So no, it doesn't work as you want it to.

    Allan
  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395
    @slayerking: Sorry - I'm easily confused.... ;-)
This discussion has been closed.