Support

Search results for ""

Sorry, no results found. Perhaps you would like to search the documentation?
All Topics
menzer

Conditional Dropdown filter

First up your hooks and filters are awesome I am creating to great things even with my limited knowledge, but I am willing to learn and it feels great to create things how you want them

I have successfully created a customised column with a filter it’s an additional column for woocommerce order to join the Events Calendar which filters products(ticket type) by events, what I would like to do is auto filter the products(ticket type) filter dropbox based on the selected Event,is there a javascript snippet I could use to do this please

4 years, 4 months ago
Stefan van den Dungen Gronovius
Developer

I’m not sure if you create the link to your overview with the selected event, but if that is the case, you could add an extra param to the URL that automatically sets the value of the drop-down filter. Every Filter drop-down has its own name that is represented in the URL. So if you have that name, you can set it in the URL with the ID (probably) and the drop-down should be selected automatically if the value exists in the options. The URL should look something like this.

{domain}/wp-admin/edit.php?post_type=shop_order&acp_filter[{$columnkey}]={value}&{restofcustomparams}

I believe this is easier then working with Javascript because the values for the drop downs are populated by an Ajax call so you also have to take care of that logic if you want to proceed with the Javascript solution. Unfortunately, I have never tried this before, so I don’t have a snippet ready to help you.

4 years, 4 months ago

You must be logged in to reply to this topic.