Okay
  Public Ticket #3662044
Pre-filtering of a table via shortcode
Closed

Comments

  • Michael started the conversation

    Is there a possibility similar to the pre-filtering via a URL (‘https://wpdatatables.com/documentation/table-features/global-search-via-url/?wdt_column_filter[3]=60|80’) 
    with the shortcode call such as [wpdatatable id=184 wdt_column_filter[3]=60|80] to pre-filter a column with numbers and a range filter? I can't do this with the variables, as the filter range should be pre-assigned.

    Thank you very much
    Michael

  •  1,767
    Miloš replied


    Hi Michael,

    Firstly, I would like to sincerely apologize for the delayed response as we have been experiencing an unusually high number of tickets. I am sorry that it has taken longer than usual to respond to your concern and your patience is highly appreciated.


    Sorry to disappoint you, but at the moment, we do not have a built-in way to predefine a number range filter through the Table shortcode like that.

    Right now, you can only use our variable placeholders (  %VAR1%, %VAR2% ... until %VAR9%) only for Text Filter type.

    It is not possible to implement a VAR placeholder in any other filter type for columns, such as numeric range, date range and so on...


    You can make a future development suggestion, but we can't say a realistic ETA on this.

    Please feel free to search on our suggestions page

     to see if someone may be already suggested this feature. If you can't see it, feel free to add your suggestion there,  and as more people vote, the feature will move higher on the priority list.

    You can certainly follow our changeLog page if you'd like ( it is also available in the plugin dashboard), where we state any changes/new features/bug fixes during updates;

    and our newsletter, so you're informed about new features, bug fixes, freebies, etc.


    Right now, if you need to predefine a number range filter in a Table, it can only be done in a couple of ways :

    1. As you found, we can do pre-filtering via URL with the 'pipe' symbol between the two values, if this Column has a number range filter setup, by adding this to the end of the URL : ?wdt_column_filter[3]=60|80.


    2. The only other way is via an SQL Query based table;

    You can try the SQL BETWEEN Operator as explained here.

    For example :

    SELECT * FROM table_name
    WHERE column_name BETWEEN value1 AND value2

    So you can insert the VAR1 and VAR2 for these values in the Query like :

    SELECT * FROM table_name
    WHERE column_name BETWEEN '%VAR1%' AND '%VAR2%'

    Then, set some initial VAR1 and VAR2 values in the Placeholders tab of back-end table settings to generate the table;

    and you can set different number range via Table shortcode, like :

    [ wpdatatable id=12 var1=60 var2=80]

    Then that "WHERE" statement will only filter that column between numbers 60 and 80.


    I hope that could help as a potential workaround.

    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