datatables .search for multiple tables

datatables .search for multiple tables

MuhaheMuhahe Posts: 25Questions: 8Answers: 2
edited December 2014 in Free community support

Hi,

is it possible to perform datatables .search on multiple tables for one column?

Something like this?

$(tablesSelectors).DataTable().column(column_number).search(searchVal, regex, smart, caseInsen).draw();

tableSelectors contain ids of tables on which i wana perform search

This question has an accepted answers - jump to answer

Answers

  • daniel_rdaniel_r Posts: 460Questions: 4Answers: 67
    edited December 2014 Answer ✓

    Hi,

    Yep, one way could be:

    $(tablesSelectors).DataTable().columns([1]).search(serachVal, regex, smart, caseInsen).draw();
    

    It will filter the second column in all those tables...

  • MuhaheMuhahe Posts: 25Questions: 8Answers: 2

    Thanks, it seems it works if i specify .columns([1]). But dunno why it wont work before :) maybe some little troll

  • daniel_rdaniel_r Posts: 460Questions: 4Answers: 67

    Yup, that what I'm gonna use in yadcf :)

  • MuhaheMuhahe Posts: 25Questions: 8Answers: 2

    yes, i was inspired by your yadcf code :) and made a little change, but somehow it only filtered one table. But then i switched it to hard coded .columns([1]), now it worked for first column, then i switched back and miracle happens! it works now :D i must try it tomorrow if magic isnt gone

This discussion has been closed.