HomeGenie Forum
Automation Program Plugins and Wizard Scripting => Help => Topic started by: maxflax on May 01, 2014, 10:20:04 PM
-
Building a widget to my program and wanted buttons in the controlwidget but seems that Im failing at the for some reason, only getting
the text of the button adding it to my html widget.
What am I doing wrong? I want a controlgroup containing 3 buttons in the widget and not in a popup.
-
Since widgets are dynamically added, if you want jquery mobile styles to be applied, you have to call trigger('create') for the widget container.
This can be placed inside the RenderView function after the var container = $(cuid);:
container.trigger('create');
It is recommended to call this only once, so add a "Initialized : false" field next to the GroupName, Description, etc..., fields.
So the code should look like this:
[{
Name: "My Widget",
Author: "Foo Bar",
Version: "2014-05-01",
GroupName : '',
IconImage : 'pages/control/widgets/homegenie/generic/images/mydefaultimg.png',
Description : '',
Initialized : false,
RenderView: function (cuid, module) {
var _this = this;
var container = $(cuid);
var widget = container.find('[data-ui-field=widget]');
var controlpopup = widget.data('ControlPopUp');
// apply jquery mobile styles
if (!this.Initialized)
{
container.trigger('create');
this.Initialized = true;
}
// ...
}
}]
Cheers,
g.