--- a/src/js/widgets.js Fri Jun 29 16:22:52 2012 +0200
+++ b/src/js/widgets.js Thu Jul 05 19:08:13 2012 +0200
@@ -54,18 +54,6 @@
this.$ = IriSP.jQuery('#' + this.container);
this.$.addClass("Ldt-TraceMe Ldt-Widget").attr("widget-type", _type);
- /* Does the widget require other widgets ? */
- if (typeof this.requires !== "undefined") {
- for (var _i = 0; _i < this.requires.length; _i++) {
- var _subconfig = this.requires[_i];
- _subconfig.container = IriSP._.uniqueId(this.container + '_' + _subconfig.type + '_');
- this.$.append(IriSP.jQuery('<div>').attr("id",_subconfig.container));
- this.player.loadWidget(_subconfig, function(_widget) {
- _this[_subconfig.type.replace(/^./,function(_s){return _s.toLowerCase();})] = _widget
- });
- }
- }
-
this.l10n = (
typeof this.messages[IriSP.language] !== "undefined"
? this.messages[IriSP.language]
@@ -120,6 +108,19 @@
});
}
+IriSP.Widgets.Widget.prototype.insertSubwidget = function(_selector, _propname, _widgetoptions) {
+ var _id = _selector.attr("id"),
+ _this = this;
+ if (typeof _id == "undefined") {
+ _id = IriSP._.uniqueId(this.container + '_sub_widget_' + _widgetoptions.type);
+ _selector.attr("id", _id);
+ }
+ _widgetoptions.container = _id;
+ _this.player.loadWidget(_widgetoptions, function(_widget) {
+ _this[_propname] = _widget;
+ });
+}
+
/**
* This method responsible of drawing a widget on screen.
*/