Can I add a clear button to Date and Location (or at least refresh the results)?

Home Forums Calendar Products Filter Bar Can I add a clear button to Date and Location (or at least refresh the results)?

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1130750
    fifteen15studios
    Participant

    Hi 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!
    Brendan

    #1131094
    Cliff
    Member

    Hi 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

    #1131317
    fifteen15studios
    Participant

    Cliff,

    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?

    #1131508
    Cliff
    Member

    You 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.

    #1137785
    Support Droid
    Keymaster

    This 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.

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Can I add a clear button to Date and Location (or at least refresh the results)?’ is closed to new replies.