How to add data-search with render?

How to add data-search with render?

MajxMajx Posts: 2Questions: 1Answers: 1

The last cell in the table looks like this:

<td>
<i class="fa fa-star checked"></i>
</td>

And what I'm trying to achieve is making the td searchable by adding a data-search attribute with a specific value to it.

I'm trying something like this but it's not working!

columnDefs : [{
targets: [-1],
render: function ( data, type, full, meta ) {
if (type === 'filter') {
return data.indexOf("fa fa-star checked") != -1 ? "true" : "false"
} else {
return data
}
}
}]
Some custom stuff that I have in the code :

responsive: true,
ajax: "test.php",
destroy: true,
responsive: true,
bProcessing: true,
bDeferRender: true,
paging: true,

Thanks.

This question has an accepted answers - jump to answer

Answers

  • MajxMajx Posts: 2Questions: 1Answers: 1
    Answer ✓

    never mind.
    I was looking at why the attribute isn't getting added but it looks like it doesn't add any attributes.
    It's working :hushed:

This discussion has been closed.