Changing td data on a searchable column

Changing td data on a searchable column

dave01dave01 Posts: 2Questions: 1Answers: 0

Hi,

I have a datatable that is populate from ajax request.

In this table I have 1 column that is searchable. This column is manipulated in the drawCallback function (I concatenate some information).After the manipulation, the data on the sreen is ok, but it wont search by the word that a added in the td.

I wonder if is there is any way to refresh or reload the { "searchable": true, "targets": [0 ]} of the columndefs, but without redrawing the datatable.

Answers

  • colincolin Posts: 1,726Questions: 0Answers: 318

    Hi @dave01 ,

    It sounds like you need to manipulate that data in the columns.render - that way, you can control how the search and the display expect to see the data. If you modify it in the drawCallback, it will still search for the raw value in the data.

    Hope that helps,

    Cheers,

    Colin

  • dave01dave01 Posts: 2Questions: 1Answers: 0
    edited August 10

    Hi @colin,

    I can't use the columns.render, because I only know the data to concatenate after the draw. What I want to do is something like that: tabelaApi.column(16).data()[0] = "something else" into the TD I have the right information, but when you search, it use the raw data and that what I need to change.

    thank you for your help

  • colincolin Posts: 1,726Questions: 0Answers: 318

    Hi @dave01 ,

    I think this example here is what you're after. I've reversed the "Office" column on the display - but you can still search for "London", "San Francisco", etc.

    Hope that does the trick,

    Cheers,

    Colin

Sign In or Register to comment.