How to reload / refresh div container of a web panel via AJS?

Hi everyone,

I wrote a web panel plugin for Jira Server to display some information on the right context in an issue.

Now I want to reload the content of the div container of the web panel without reloading the whole page.

I want to use the velocity template file of the webpanel view which then has to call the method “getContextMap()” of the context-provider on reload.

I already tried:

AJS.$("#webpanel").load("...");

But I don’t know what to put into the load("…") command.

My web panel has the id “webpanel”.

<div id="webpanel" class="module toggle-wrap">

</div>

Can anyone give me a hint how to do that?

Kind regards

Hi @meins,

By doing this:

You’re actually doing the same thing as:

$("#webpanel")

which will return a jQuery object for that id, and calling load function actually pertains to this.

If you want to reload the page, you can try doing this via ajax and some DOM manipulation.

Cheers,
Anne Calantog

Hi acalantog,

thanks for your quick response. I tried some stuff with ajax requests.

I tried to load the whole jira page and to cut the part I need.

But now I’m facing the problem that my webpanel is not updated, meaning getContextMap(…) of my plugin is not called, when uising the ajax "load(URL-To-Jira-Issue-Page)’?

Do you have an idea how to do that?

Kind regards,

Dennis

Hi @meins,

May I ask what are you trying to do? What do you want to load in your panel? And what is the part the you cut and tried to load in the jira page?

Cheers,
Anne Calantog

HI @acalantog,

I developed a small plugin to show up some information at the right context of an issue.

The plugin has a webpanel and a webwork component. The webwork component handles the “POST”-Actions sent from the webpanel component. This causes a full page reload, which then updates my webpanel component depending on the previous action, handled by the webwork component.

Now I’m trying to perform the whole process cycle (“post”-action -> update webpanel) only within the scope of the webpanel div-container instead reloading the whole page.

So my idea was to get the new state of the webpanel div-container via an ajax request.

But maybe there is a much more simple way to do that :slight_smile:

Kind regards

Hi @acalantog

I think I have to change my point of view!

I will write a velocity file with some javascript code, which updates itself and which does not need to be updated from external calls. Maybe this is a better way to do it.

Kind regards,

Dennis

Hello, @meins

Have you finally found a way to reload the web-panel? I’m facing a similar problem and would be very thankful for any guidance.