Okay
  Public Ticket #2145799
WPDataTable
Closed

Comments

  • dibixsrl started the conversation

    Hello,

    I purchased your plugin some time ago, now I have another project with some peculiar requests from my customer all about data filtering, so before adopting your plugin as the solution proposed I need to know 2 things:

    1) Is there a way (using a hook or else) to use the filters in OR instead of AND

    2) Is there a way (using a hook or else) to order alphabetically the options in the multiselect? (I mean the options added in the section Data -> Define value list)

  •  2,498
    Aleksandar replied

    Hello dibixsrl.

    1) Filters are currently set up to use "OR" with select and check-boxes. You can see this in ../wp-content/plugins/wpdatatables/source/class.wpdatatable.php around line 1681:

    $j = 0;
        $search .= " (";
        foreach ($checkboxSearches as $checkboxSearch) {
          if ($j > 0) {
             $search .= " OR ";
        }
    

    If you need to change it from "OR" to "AND", simply modify that so it looks like this:

    $j = 0;
        $search .= " (";
        foreach ($checkboxSearches as $checkboxSearch) {
          if ($j > 0) {
             $search .= " AND ";
        }

    2) Unfortunately, at the moment, the values are being read in the order they appear in the table, and to get the to appear alphabetically you would need to enter them manually one by one.

    You're welcome to take a look at our hooks and filters and see if there's anything that could help you out there.

    Please note that using hooks requires certain level of programming skills and included support refers only to advice.

    Best regards.

    Kind Regards, 

    Aleksandar Vuković
    [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