Okay
  Public Ticket #3503831
filtering
Closed

Comments

  • Gloria started the conversation

    Hello,

    in some cases when using multiple filters on a wpdatatable i need to apply OR condition instead of AND condition upon filters. Is this feature available ?

    Best regards

  •  1,708
    Miloš replied

    Hello,

    To begin, I want to extend my heartfelt apologies for the delayed reply, 

    which is due to an unexpectedly high volume of inquiries. 

    We truly value your patience during this period.

    -

    We got advised by our developers.

    The logic for checkboxes in our plugin is "OR" by default in cases when we only filter inside one column.

    For filtering combined between multiple columns, then our plugin's default logic is as "AND",

    so it does not work as intended in your use-case by default.

    Here is a workaround you can do,  this works only for "server-side" processing tables,

    which are Manual Tables ( they always have server-side processing enabled),

    and SQL Query-based tables ( for them we can toggle server-side processing within Data Source settings).

    In a PHP file located in this path :

    ..wp-content/plugins/wpdatatables/source/class.wpdatatable.php 

    around line 2433, find this :

     $search .= ' AND ';

    replace it with :

    $search .= ' OR ';
    

    Important to note :  When you update our plugin, this code will revert back to default,

    so at each update, you would have to edit this piece of the code.

    This is then going to be applied for all tables in your plugin and not just for checkbox filtering,

    but for filtering of all other columns, because the filtering goes through the same logic in our plugin,

    and the "link" between columns is "AND" by default, as mentioned.

    -

    For tables that are "non server side processing", which are tables linked with data source,

    or SQL Tables with disabled server-side option,

    at the moment we do not have a workaround, for these kinds of tables you could only try to devise a completely custom solution,

    or to integrate the search builder extension for DataTables.

    DataTables is the JQuery plugin that our plugin is based upon.


    Let me know if that achieves your goal - or if you meant something else?

    Thank you.

    Kind Regards, 

    Miloš Jovanović
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables