Dialog2 box not getting triggered on issues search view from More dropdown item

This is in continuation with my question 695430#M227429, I am able to create a dialog2 modal box from the more section link with the steps mentioned in the prev question, but it is not working in the issue search view.

1 answer

1 accepted

I'm not sure if the code you copied above is the exact code you're using, but there are some holes that need filling if we're to guess at why it's not working.

What does "actionButtons();" do?

Where is the "actionButtons" function defined?

How are you adding event handlers to the link that's meant to open the dialog?

Are you passing a value for "$" in to your immediately-executing function? In the code snippet you provided, the value for $ would be undefined, so I'd have to assume you are if you say it's working on another page...

Are there any javascript errors that occur on the page, either before or when you click on the link? You could check this in your browser's developer tools by preserving the console log messages when the page is changed.

My guess at this stage is that the code that's meant to register the event handlers on your button aren't actually being registered.

If it works on one page, but not on the issue search page, some additional thoughts on what might be going wrong:

Where are you rendering the link? Is it inside the view issue panel?

Again, how are you binding the event handlers to the link that's meant to open the dialog?

The issue search page re-renders the issue panel whenever the user browses to a new issue. If you're registering your event handlers by explicitly finding and binding events to the element itself, that element will be destroyed when the view issue panel re-renders. It would be much better to use delegate event handlers on the document instead; that way it won't matter whether the panel is re-rendered, the handlers will still work.

Some other suggestions:

Does your "#custom-link" element have to be a hyperlink? If it were, for instance, a <button type="button"> element instead, there would be no need to remove a href from it, since it would only ever handle clicks in the way you told it to.

Also, as a tip, you'll find a whole lot more developers working on their own plugins in the developer forums; my understanding is that community.atlassian.com is more geared toward product usage rather than alteration.

Thanks for your reply. I got the mistake. I was not passing value for "$" into my function. Now it works perfectly in Issue view, Issue search screen and partially on the scrum boards.

I am rendering the link inside the issue view as a new web-item in More drop-down list.

For registering the event handlers, I am using functions like AJS.$(document).on("click", "#custom-link", function (e) {e.preventDefault();AJS.dialog2("#my-dialog").show();});

But now when i go through the scrum board (ie, In scrum board - > select any issue to see preview mode . Then Select 3dots (. . .) on the right top corner of the issue preview - > select More Actions -> select the same web item from the drop down.) Dialog2 box not rendering

How can I bind the event handlers here?

Thanks once again for your help.

Regards,Arun

You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.

I’m a designer on the Jira team. For a long time, I’ve fielded questions from other designers about how they should be using Jira Software with their design team. I’ve also heard feedback from other ...