Suppose I have created a button inside a custom InfoTemplate
(aka 'popup') widget in my Web AppBuilder
app:
var editButton = new Button({
label: "Edit Schedule",
onClick: function () {
editButton.setDisabled(true); //disable the edit button on first click
} });
editButton.startup();
What I want is to launch another widget called 'TaskManager'
when the onClick
event is triggered. It seems like I need to use a library class called WidgetManager
but I can find any practical example for my scenario. It seems like I need to use something like this:
openWidget(widget)
The openWidget
method requires the Widget ID, which I am having trouble locating in my app (I know the name is TaskManager
from the manifest.json
file but can't find the id
attribute). I've also seen example where a function is created, I assume inside the InfoTemplate
widget, that will point to the TaskManager
widget and can be called inside the click event:
_openTaskManager: function () {
var taskManager, sbc;
var widgetCfg = this._getWidgetConfig('CustomInfoTemplate');
if (widgetCfg) {
sbc = WidgetManager.getInstance().getWidgetsByName('TaskManager')[0];
sbc._resizeToMax();
sbc.setOpenedIds([widgetCfg.id]);
}
},
then => _openTaskManager();
Am I on the right track? Is there an easy way to do this or am I way off? Any suggestions?