Okay
  Public Ticket #2948260
How to hide a table until a selection is made for all visible filters?
Closed

Comments

  • Jonathan started the conversation

    Hi,

    I just purchased this plug-in as well as the Powerful Filters add-on. Works well so far. 

    I have two fields above a table for visitors to filter data. I require the table to remain hidden until the visitor makes a selection in both fields.

    Fortunately, there is an option in the Powerful Filters add-on to Hide table before filtering. 

    Unfortunately, this option only hides the table when there are no selections. So when the visitor inputs a selection in the first field, the table appears prematurely. 

    Is there a way to have the table remain hidden until the both filter selections are made?

    Thanks in advance.

  • Jonathan replied

    As a bit of an update. There is a work-around. If I enable the Show Search Filters Button and Disable Search Button until all filters are selected, it solves the initial problem.

    However, it breaks the pre-filter by URL feature. I.e. I have links elsewhere on the website that pre-filter the table. But the feature Disable Search Button does not recognise these pre-filters as user input. 

    So is there a fix for this?

  •  2,572
    Aleksandar replied

    Hey Jonathan

    The logic of the plugin doesn't allow prefiltering to be used when you enable "Disable search button until all filters are selected", but I have forwarded the ticket to our development team, and I'll get back to you as soon as I hear from them.

    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

  •  2,572
    Aleksandar replied

    Hello again Jonathan.

    When "Hide table before filtering" is enabled, filtering per URL doesn't work because the state of the filters is not being checked when the page is loading, only when something actually changes in the filter does the logic for displaying the table trigger.

    A workaround would be to go to ../wp-content/plugins/wdt-powerful-filters/assets/js/wdt.pf.frontend.js and on line 46 add this:

    var optionSelected = false;
                var searchFiltersButtonContainer = '.wdt-search-filters-button-container[data-wpdatatable_id=' + tableDescription.tableWpId + ']';
                $(searchFiltersButtonContainer + ' .filter_column').each(function () {
                    optionSelected = isFilterOptionSelected($(this));
                    return !optionSelected;
                });
                if (optionSelected) showHiddenTable();

    Please try that, and let me know if it works.

    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