Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Won't trigger a second time when used as part of an async HTML partial #82

Open
michael-zock opened this issue Jul 31, 2014 · 1 comment

Comments

@michael-zock
Copy link

Hi

I have a situation where the time picker is used in a modal popup that's loaded using Magnific Popup.

The first time, everything works as expected, but if I close the popup and open it again, clicking the text field won't trigger anything anymore.

I've already tried to call the refresh every time the partial is loaded again (in case something needs to be triggered again) and I've extended the popup's close() method to include a call to your plugin's destroy method, made my JS more verbose to exclude problems caused by the use of shorthan methods (e.g., access by helper class instead of ID), but no dice.

$("#beginTime").timepicker({
    showPeriodLabels: false
});

$("#endTime").timepicker({
    showPeriodLabels: false
});

$("#beginTime").timepicker("refresh");
$("#endTime").timepicker("refresh");

$.magnificPopup.instance.close = function () {
    $("#beginTime").timepicker("destroy");
    $("#endTime").timepicker("destroy");

    $.magnificPopup.proto.close.call(this);
};

Has anybody run into a similar situation before?
I'm not sure if this is an incompatibility or if this use case just required an additional step that's just not in the documentation.

@michael-zock
Copy link
Author

Workaround:
Turns out that it will work if I add the following line to the end of the _destroyTimePicker function and the refresh calls in my example above are not neccessary either.

$("#"+this._mainDivId).empty().remove();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant