• Resolved goose2009

    (@goose2009)


    Hi Tobias,

    Is it possible to exclude one of the columns from being searched? I have a bunch of audio links in a table, and if I type something like href or mp3 into the search bar, everything is still displayed. It’s not a big deal, but I’d love to be able to exclude that column.

    Thanks!

    https://www.ads-software.com/plugins/tablepress/

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi,

    thanks for your question.

    Yes, excluding certain columns from the search is possible with extra code for the DataTables JS library. Please add this to the “Custom Commands” textfield on the “Edit” screen of the table:

    "aoColumnDefs": [ { "bSearchable": false, "aTargets": [ 0 ] } ]

    The 0 indicates that the first column should be excluded (counting starts with 0 in the code).

    Regards,
    Tobias

    Thread Starter goose2009

    (@goose2009)

    Thanks Tobias!!

    Thread Starter goose2009

    (@goose2009)

    One more question. I’m also using the command you referenced in another discussion to hide a column, but still make it searchable:

    “aoColumnDefs”: [ { “bVisible”: false, “aTargets”: [ 4] } ]

    How would I utilize both of these at the same time? I can get them both to work when used alone, but when I input both into the custom commands field, The search bar goes away and neither of the commands work.

    Thanks!

    Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi,

    you’ll just have to merge these two commands to one:

    "aoColumnDefs": [ { "bSearchable": false, "aTargets": [ 0 ] }, { "bVisible": false, "aTargets": [ 4 ] } ]

    Regards,
    Tobias

    Thread Starter goose2009

    (@goose2009)

    works great, thanks!

    Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi,

    sure, no problem, you are very welcome! ?? That’s good to hear!

    Best wishes,
    Tobias

    P.S.: In case you haven’t, please rate TablePress here in the plugin directory. Thanks!

    Hi Tobias,

    Thanks for the TablePress plugin. While checking above codes for search activation for hidden column, I found that search text box and number of items list disappear after adding above in JS call.

    Is any extra code required apart from above?

    Will appreciate your support.

    thanks,
    Raj,

    Thanks I managed to work out on the code.

    Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi,

    very nice! Most likely, there was just a typo, and that then broke the JS code.

    Best wishes,
    Tobias

    P.S.: In case you haven’t, please rate TablePress here in the plugin directory. Thanks!

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Excluding a certain column from search’ is closed to new replies.