• Resolved adambloomer

    (@adambloomer)


    Hiya,

    When I switch from calendar Grid view to the List view using the dropdown and then click the back browser button, the dropdown is still showing ‘List’ when it should reset back to ‘Month’. This seems to happen intermittently and I think I’ve isolated the issue:

    in attempting to fix this with Javascript, my scripts only worked intermittently too so I think the ajax refreshing of the calendar on page load is killing off Javascripts that are running at the same time.

    If i’m on the wrong track please tell me but is there anything you can suggest as I think your own javascript is getting killed off when ajax refreshes and it’s something you need to fix in your plugin.

    Does The Events Calendar offer any sort of javascript callback functions based on your ajax calls?

    Thanks,

    Adam.

    https://wordpress.org/plugins/the-events-calendar/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter adambloomer

    (@adambloomer)

    I’ve done more digging and it seems that the list elements in the <ul class="tribe-bar-views-list"> should be inverted and the “tribe-bar-active” class switched over to the month list element but sometimes this doesn’t happen.

    I’ve managed a hacky fix using jQuery that waits for the ajax to finish refreshing the calendar using:

    $(document).ajaxComplete(function() {
    });

    within this function, i then clone both list items (starting with the list view one – we want that to end up underneath the month view in the dropdown), prepend them to the containing unordered list which puts them in the correct order. I switch the classes over and I then remove both of the leftover nodes and we have a solution:

    $(document).ajaxComplete(function() {
        $('li.tribe-bar-views-option-upcoming').clone().prependTo($('ul.tribe-bar-views-list')).removeClass('tribe-bar-active');
        $('.tribe-bar-views-option-month').clone().prependTo($('ul.tribe-bar-views-list')).addClass('tribe-bar-active');
        $('.tribe-bar-views-option:nth-last-of-type(-n+2)').remove();
    });

    Any better solution would be much appreciated.

    Brook

    (@brook-tribe)

    Howdy adambloomer,

    Thanks for reporting this. I am ticketing it as a bug for our dev team. They can come up with a fix then roll it into a future maintenance release.

    In the mean time your hack looks like a good solution, thanks for sharing it. Truth be told this will likely be a lower priority ticket since it is a cosmetic issue. We will still get it fixed, but naturally have to prioritize no cosmetic bug fixes first. I hope you understand that.

    Cheers!

    – Brook

    Plugin Contributor leahkoerper

    (@leahkoerper)

    Hi there,

    I just wanted to let you know that we were able to work on this issue for our upcoming 3.8 release. Keep an eye out on your site for an update announcement! If you update and are still seeing this problem, please post a new thread so we can check it out. Thank you for your patience while we got this fix in place.

    Best,
    Leah
    and the team at Modern Tribe

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘View dropdown not resetting when using back button’ is closed to new replies.