Home › Forums › Calendar Products › Filter Bar › Can I add a clear button to Date and Location (or at least refresh the results)?
- This topic has 5 replies, 4 voices, and was last updated 9 years, 9 months ago by
fifteen15studios.
-
AuthorPosts
-
June 22, 2016 at 7:39 pm #1130750
fifteen15studios
ParticipantHi Modern Tribe,
It’s me again! Before I get in to discussing my issue, I’d like to mention that I know this might sound like a customization. However, I’m curious if this feature is built in, and if not, if there are other features which could account for it. I’ve done my research, but I haven’t found an answer and I’m not that sharp with jQuery or Ajax… and this is all jQuery and Ajax.
Onto the issue:
I’m interested in adding a “clear” button next to my date field and location field. What I’d like it to do is, when clicked, remove the information from the respective field and refresh the results. I’d also like to know if I can build it so I can clear the date AND time of day, or location AND distance. This feature may already exist in the system, and if not, it’s probably a simple call to a function.
If there’s no good answer here, maybe I can create my own. I can make a button which can clear the information, but I don’t know what to call in order to “refresh” the page’s results. Is there a function I can call which will update the page results and URL information when I click something?
Thanks! Any help will be appreciated. I’ve been struggling with this for a while, but understanding this better will help me develop more parts of the site I plan to modify.
Thanks!
BrendanJune 23, 2016 at 10:17 am #1131094Cliff
MemberHi Brendan.
This should be straightforward with jQuery, which is already built into WordPress.
However, we already have a Reset Filters button. Is that not sufficient for your needs? If it is, maybe you could do a CSS customization to that button.
If you do need to add custom JavaScript or jQuery, you can see how the Reset Filters button works around Line 206 in this file: /wp-content/plugins/the-events-calendar-filterbar/src/resources/js/filter-scripts.js
June 23, 2016 at 7:50 pm #1131317fifteen15studios
ParticipantCliff,
Thanks for the advice! I’ll check it out. The clear button which came with the script was helpful, but it cleared all fields. I want specific clear buttons for each field. Unless I’m missing something and there are individual clear buttons for each one somewhere in the settings and I didn’t know it?
June 24, 2016 at 8:24 am #1131508Cliff
MemberYou are correct that the built-in Reset Filters button is designed to clear/reset all Filter Bar fields.
Your custom button’s JS/jQuery code would need to target the specific Filter Bar fields you want to target.
You may choose to use the Reset Filters code as a starting point or just write some code from scratch. It’s your choice. If you need some coding help, you may want to ask your developer or reference our list of known customizers.
July 9, 2016 at 9:35 am #1137785Support Droid
KeymasterThis topic has not been active for quite some time and will now be closed.
If you still need assistance please simply open a new topic (linking to this one if necessary)
and one of the team will be only too happy to help. -
AuthorPosts
- The topic ‘Can I add a clear button to Date and Location (or at least refresh the results)?’ is closed to new replies.
