Hello guys,
I need a way to refresh the whole gadget with an onclick button on the gadget screen, is that even possible?
I tried things like: <a onclick="gadget.showView(true);" class="refreshbutton">Refresh</a>
But got no results.
Are there any other functions I can use to solve that or any other ways to do it?
Thanks in advance.
Community moderators have prevented the ability to post new answers.
Yes! You can try to use this code in gadgets\yourgadget.xml
You can see example sources on https://github.com/DmitryMiroshnichenko/jira-mailru-a1-plantasks-gadget-plugin/blob/master/src/main/resources/gadgets/a1-plantasks.xml
view: { enableReload: true, onResizeAdjustHeight: true, template: function(args) { var gadget = this; gadget.getView().html(args.restresult.html); // reload function function reloadGadget() { if (document.activeElement.tagName == "IFRAME") { document.getElementById(document.activeElement.id).contentWindow.location.reload(true); } else { window.location.reload(true); } } // reloading after user change jQuery("[name='a1-plantasks-all-users']").change(function () { reportUser = jQuery("[name='a1-plantasks-all-users']").val(); jQuery.cookie('a1_report_user', reportUser, { expires: 2 }); reloadGadget(); }); // reloading after project change jQuery("#tg-project-selector").change(function () { selectedProject = jQuery("#tg-project-selector :selected").val(); jQuery.cookie('tg_selected_project', selectedProject, { expires: 365 }); reloadGadget(); }); // reloading on click jQuery("#a1-plantasks-show-my-dash").click(function () { jQuery.cookie('a1_report_user', '', { expires: 2 }) reloadGadget(); });
Hi Dmitry, I've putter the 'window.location.reload(true);' directly in the onclick and it worked really well, thanks a bunch for the help! :D
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No problem:) Those iframe's make life harder)))
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.