Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a way to bind JavaScript (from a fragment) to the finished loading of a Kanban Board view?

Stefan Stadler
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 19, 2024

Hi team,

I am trying to execute some code for Kanban boards. The code is working fine if I click a card and the issue details open up. However, this is not happening when the page is loaded. The best trigger I could find is the following:

AJS.toInit(funtion () {

   myCodeGoesHere;

});

However, from the logging, all objects to be accessed are not available, so this seems to be too early.

In the browser logs, I could see a message like this:

callback: Finished callbacks for gh.work.pool.rendered

Is there a way to attach the execution of my code to this event? Or is there any Jira event that marks the completion of a board content?

Thanks!

Stefan

 

 

2 answers

1 accepted

1 vote
Answer accepted
Stefan Stadler
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 28, 2024

After doing investigation and researching, I have found a set of events specific for boards (Greenhopper), which work like a charme. This has been described in this thread:

JIRA.Events.NEW_CONTENT_ADDED not working correctly on agile board - Jira Development / Jira Server - The Atlassian Developer Community

In short, looking at the available events did the trick. Now, I can use the following code to trigger the modification whenever a column is updated:

(function ($) {
$(function () {
AJS.$(GH).bind('pool-column-updated', function (event, data) {
//my code goes here
});
});
})(AJS.$);

I hope this can help others as well.

Regards,

Stefan

0 votes
Dick
Community Champion
August 20, 2024

Hi Stefan,
Typical startup of javascripts is when the DOM is loaded. You can achieve this using something similar to: stuff mentioned at stackoverflow.


Stefan Stadler
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 21, 2024

Hi Dick,

it is not enough to wait for the DOM to be loaded. This is already happening but the DOM in a Kanban board seems to be populated using JavaScript after this event is fired.

I have now tried using $(window).load but even with that, the jQuery selector return no elements, while it returns elements when clicking an issue so that the panelRefreshed Event is triggered.

So the question is more: Is there a way to figure out when the content of the board (i.e. the cards) are displayed?

Thanks for your help!

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
VERSION
9.4.1
TAGS
AUG Leaders

Atlassian Community Events