Groups
Groups
Sign in
Groups
Groups
Jenkins Developers
Conversations
About
Send feedback
Help
Minimizing a custom widget
11 views
Skip to first unread message
Joachim Nilsson
unread,
Nov 2, 2015, 6:53:47 AM
11/2/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Jenkins Developers
Hi
How do I minimize a custom widget?
I have added an index.jelly page with content:
<?xml version="1.0" encoding="utf-8"?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:l="/lib/layout">
<l:pane width="2" title="Get a number">
<tr>
<td align="left">Number</td>
<td class="my-count" align="right">${it.number}</td>
</tr>
</l:pane>
<script>
var widget = <st:bind value="${it}"/>;
var upDateInterval = 1000;
window.setInterval(function() {
widget.getNumber(function(t) {
document.getElementsByClassName('my-count')[0].textContent = t.responseObject();
})
},upDateInterval);
</script>
</j:jelly>
and my class:
@Extension(ordinal = 500)
public class MyWidget extends Widget {
private int x = 0;
@JavaScriptMethod
public int getNumber() {
x++;
return x;
}
}
When I press the minimize icon, nothing happens. Is there some code to add for this feature to work?
Regards,
Joachim
Joachim Nilsson
unread,
Nov 25, 2015, 6:54:46 AM
11/25/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Jenkins Developers
Thanks mattiasclaesson for the input. It was correct: adding an ID to the jelly pane was enough to be able to minimize it.
<l:pane width="2" title="Get a number" id="MyUniqueWidgetId">
Reply all
Reply to author
Forward
0 new messages