Individual column filtering not working with HTML in cells

Individual column filtering not working with HTML in cells

oktalkoktalk Posts: 3Questions: 0Answers: 0
edited November 2013 in DataTables 1.9
I'm using this " http://datatables.net/examples/api/multi_filter_select.html " on my table successfully. Unfortunately, my table cells contain HTML. Because of this I'm not able to sort using the select elements. From what I can tell it looks like I need to modify the "fnGetData" function to only get the inner text of the cell and not the HTML, but I don't know how to do that.

Could anybody help?

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    Hi,

    "Not able to sort using the select elements" - aren't the select elements being used for filtering? Or are you wanting to sort the select elements?

    Allan
  • oktalkoktalk Posts: 3Questions: 0Answers: 0
    I meant to say "filter" not sort. Here is a fiddle of my code: http://jsfiddle.net/96GEU/

    I'm using this exact method: http://datatables.net/examples/api/multi_filter_select.html
    The only difference between the example and my implementation is I have HTML in my cell tables. So my select elements look like this:
    [code]

    Some Text

    [/code]

    I need a way to grab the text of a cell, not the innerHTML of the cell, and add that to the value attribute of my option tag. Any ideas? Please use the fiddle if you can.
  • oktalkoktalk Posts: 3Questions: 0Answers: 0
    I've tried setting the sType like this:
    "...
    "aoColumnDefs": [
    { "sType": "html", "aTargets": [ "_all" ] }
    ]
    ..."
    But that didn't do it. Updated example: http://jsfiddle.net/96GEU/1/
This discussion has been closed.