• Resolved scottmotion

    (@scottmotion)


    I am having a conflict when I use the ColumnFilterWidgets in the shortcode with columnDefs searchable in the Custom Commands input. I am trying to make some columns searchable and other columns filterable, however they don’t play nice together.

    Custom Commands: “columnDefs”: [ { “orderable”: false, “targets”: [ 0,4,5,7,9 ] }, { “searchable”: false, “targets”: [ 0,1,5,6,7,8,9] } ]

    Shortcode: [table id=12 datatables_columnfilterwidgets=true automatic_url_conversion=true datatables_columnfilterwidgets_exclude_columns=0,1,2,3,4,5,9,10 cache_table_output=true responsive=scroll filter=”Draft” filter_inverse=true /]

    With this configuration the columns I choose become searchable, but the dropdown filters don’t work and the table responds with “No matching records found”.

    When I remove those columns (5,6,7) from the searchable targets array then the dropdown filter works, but of course those columns now become searchable.

    I understand that the “search” is actually a filter, so I assume this is where the conflict lies, but I can’t figure out the solution.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    thanks for your post, and sorry for the trouble.

    I’m not completely sure, but from what I know about the external JS libraries, the searchable option is basically used to enable the underlying functionality. And this is then used by the ColumnFilterWidgets. So, if searchable is turned off, the ColumnFilterWidgets doesn’t have a function to work with, so to speak.

    Thus, I don’t think that the external scripts allow what you are trying to achieve ??
    (To verify this assumption, can you maybe try this on a small table, with just two or three columns or so, and without all the other things that don’t really play a role for this, like the orderable settings, etc.?)

    That said, is it really that critical if the search text field also shows results from the filters?

    Regards,
    Tobias

    Thread Starter scottmotion

    (@scottmotion)

    Thanks for responding Tobias! Love to see the interaction from developers!

    I think we both came to the same conclusion that my setup is just too complicated and the library won’t allow it, or at least wasn’t designed to handle it. I did try it with a small simple table and got the same result.

    You’re right though, it isn’t critical to hide the other columns from search. I’m just trying to keep the experience consistent. The truth is that I need to move this particular content to a custom post type.

    TablePress is awesome and I’m excited to see v2!

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    no problem, you are very welcome! ?? Good to hear that this helped — at least clear up the confusion!

    As for v2 (in case you haven’t seen that post): https://tablepress.org/8-million-downloads-tablepress-2-0/

    Best wishes,
    Tobias

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘DataTables ColumnFilterWidgets and columnDefs searchable conflict’ is closed to new replies.