Okay
  Public Ticket #3506886
Filtering rows based on data
Closed

Comments

  • Abigail Welborn started the conversation

    I would like to filter out rows that have Quantity < 1 (i.e., = 0). I'm comfortable programming, but I'm not sure if there's already a built-in way to do it.

    The table in the URL syncs with a Google spreadsheet (thank you for that feature!). I'd basically like to have a default filter on the column of "> 0", which is similar to the "predefined value" of the filter column, but it can only be specific values, not a formula.

    If I can't hide the row, I can use conditional formatting to grey out the row, but ideally I could hide it.

  •  1,708
    Miloš replied

    Hi Abigail,

    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.

    -

    I am not sure i fully understood exactly what you need to achieve.

    1. If you just need to hide any rows that have value in Quantity less than 1,  with a Google Sheet Table, one way is with Conditional Formatting.

    Like this, here is my Test Table :

    2103748111.png

    A Condition like : Check if any cell of this Column is less than 1 ,  in that case, set the row CSS class to "hide".

    4665187577.png
    3152824916.png

    2. Or if you don't wish with the Conditional, but to allow users to change the Filter/clear it;

    Then you can set a Number Range Filter, and set the "from" value to be predefined as "1".

    5912501521.png
    9623463254.png

    3. Another way can be via URL pre-filtering.

    Please check the Documentation on the hyperlink with our example.

    With a Number Range, you need to use the " |  " stick symbol for the URL predefined filter parameter on this Column in order to get only the "from" value on the number range.

    On my example the full URL is :

    http://localhost/current/pre-filter-above-zero/?wdt_column_filter[2]=1|
    
    7934482784.png
    1531807482.png


    Since the URL pre-filtering uses a zero based index for column number, my "Quantity" Field is indexed as number 2, so i add this as parameter :

    ?wdt_column_filter[2]=1|

    -

    I hope that one of these methods can achieve your goal, but let me know if i misunderstood it.

    Thanks.

    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