Okay
  Public Ticket #2906113
Prefilter Google Spredsheet
Closed

Comments

  •  3
    Miroslav Kulanga started the conversation

    Hi,

    i would like to display only records based on specific value in the wpdatatable from Google Spredsheet. E.g. deactivated = 0

    If I filter my google Spredsheet and add the "fvid" parameter to the URL of the Goggle Spredsheet in wpdatatables, the filter is not recognized and all data is loaded. 

    How can I prefilter?

    Thank you,

    Miroslav

  • [deleted] replied

    Hi Miroslav

    Thank you for reaching out to us.

    You can add a filter through the shortcode if you assign one of our placeholders to column settings/filters/predefined filtering value.

    8052151734.png

    If you add %VAR1% as a predefined filtering value to ColumnA, for example, it will load all the data (because the placeholder is not defined in the Placeholders tab above the table). Then, when you add the shortcode like:

    [wpdatatable id=1 var1=150] it will filter the table per columnA with the value of "150".

    I hope this helps, do let us know if you need any further assistance.


  •  3
    Miroslav Kulanga replied

    Unfortunately this does not help. By pressing "Reset filter" by the user, this filter can be reseted so all the data is then visible. I would like to prefilter or query the data of Google Spreadsheet like e.g. in SQL query:  SELECT * FROM MyTable WHERE deactivated = 0

    And the user should not be able to reset the filter.

    I have a solution for this. But I was not possible inside wpdatatables because this ignores the filter of google Spreadsheet.

    So now the solution.

    1. Create another blank sheet with name e.g. "Filtered". 
    2. Paste only column names without data
    3. in the A2 paste this formula =FILTER(A2:AO1000; here_is_your_filter_condition)
      e.g. =FILTER(A2:AO1000; ISBLANK(AO2:AO1000))
    4. enjoy filtered table
    5. paste the URL from this filtered sheet to wpdatatables

    The solution is not to use the built in filter of google sheets but filter the table by formula.

    Hope this help others. Maybe TMS can make a solution where filter is not ignored.


  • [deleted] replied

    Hi Miroslav

    If you are going to use a Google Spreadsheet with formulas, please follow this – Tutorial

    Another option would be to add an additional column and hide it from the front end then prefilter per this column since it will not be displayed on the front or included in the filtering options the client will not be able to clear the filter. 

    I hope this helps, do let us know if you need any further assistance. 

  •  3
    Miroslav Kulanga replied

    Dear Blaženka,

    thanks for your reply. Your second recommendation sounds interesting. Can you explain it more?

    If I hide column from front end and would like to use it for filtering it still displays in the filter options for the user. This means, the user can manipulate it = reset this. It is not possible in wpdatatables to filter column and not displaying it in user filter. Or am I wrong?

  • [deleted] replied

    Hi Miroslav

    You will need to do this with some custom CSS.

    I can explain how to find and copy the selectors you need to use to hide something.

    Right-click on the part you wish to hide and inspect the element:

    1262040153.png

    Then, when you hover over the code, that section will be highlighted in the modal. Right-click on the code that highlights the entire div, and go to copy/copy selector:

    4176821730.png

    Paste that selector, and add "display: none !important;", like this for example if you want to hide something, 

    #tab-extras {
    display: none !important;
    }
    

    Certain selectors can't be combined, so if it doesn't work when you separate them with a coma, simply add another selector below }

    If this doesn't help either, we can recommend these services for customization

    https://codeable.io/?ref=l1TW1

    https://wpkraken.io/?tms-plugins

  •  3
    Miroslav Kulanga replied

    Hm, your posts are not very helpful.

    1. you are posting something about Amelia and not wpdatatables

    2. I am web developer, so I know very well, how to use CSS and display: none!important

    3. you are not replying to questions. When a filter is set it also displays in the filter. After click on reset button also invisible filters are resetted.

    So please explain how to prefilter Google Spreadsheets in a way, where user can not reset this filter in wpdatatables. Thank you

  •  2,572
    Aleksandar replied

    Hello Miroslav

    Sorry for the late response.

    1. I'll ask you for some understanding here. Blazenka is covering 7 products and is working on quite a lot of tickets during the day, but at the end of the day she is human, and some errors do go through.

    2. If you want to include the "Clear Filters" button, you will not be able to achieve this without applying another sheet to create a table. When you add a predefined value (%VAR1%), and filter the table using the shortcode, the filter is being applied to the table, regardless if you hide it or not. So, when you click on "Clear Filters" that value is going to be cleared as well.

    2.1. Either disable the "Clear filters" button, and use Custom CSS to hide the filter from the front-end table, or;

    2.2. Create a new Google Spreadsheet Tab (you can use the same spreadsheet, just another tab), where you can filter the data from the first tab. When you copy the URL of the second tab to create the table, you'll see the data filtered in the 2nd tab of your Google Spreadsheet.

    3. This is explained in #2.

    If you have any other questions or suggestions about this, please feel free to ask.

    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

  •  3
    Miroslav Kulanga replied

    Hello Aleksander,

    thank you for your reply. You described the same solution as I have already written below. But thank you for your time. So at the moment an extra table is the only way.

    Best regards, 

    Miroslav

    P.S: I like wpdatatables very much. Perfect work

  • [deleted] replied

    You are most welcome on behalf of the entire team. 

    If there is anything else we can assist you with please don't hesitate to open a new ticket.

    Have a wonderful day!