src/js/widgets.js
branchnew-model
changeset 927 977a39c4ee80
parent 924 64c2eaafe5e2
child 957 4da0a5740b6c
equal deleted inserted replaced
926:e47ed8eb75cd 927:977a39c4ee80
   108     });
   108     });
   109 }
   109 }
   110 
   110 
   111 IriSP.Widgets.Widget.prototype.insertSubwidget = function(_selector, _propname, _widgetoptions) {
   111 IriSP.Widgets.Widget.prototype.insertSubwidget = function(_selector, _propname, _widgetoptions) {
   112     var _id = _selector.attr("id"),
   112     var _id = _selector.attr("id"),
   113         _this = this;
   113         _this = this,
       
   114         _type = _widgetoptions.type,
       
   115         $L = $LAB;
   114     if (typeof _id == "undefined") {
   116     if (typeof _id == "undefined") {
   115         _id = IriSP._.uniqueId(this.container + '_sub_widget_' + _widgetoptions.type);
   117         _id = IriSP._.uniqueId(this.container + '_sub_widget_' + _widgetoptions.type);
   116         _selector.attr("id", _id);
   118         _selector.attr("id", _id);
   117     }
   119     }
   118     _widgetoptions.container = _id;
   120     _widgetoptions.container = _id;
   119     _this.player.loadWidget(_widgetoptions, function(_widget) {
   121     if (typeof IriSP.widgetsRequirements[_type] !== "undefined" && typeof IriSP.widgetsRequirements[_type].requires !== "undefined" ) {
   120         _this[_propname] = _widget;
   122         for (var _j = 0; _j < IriSP.widgetsRequirements[_type].requires.length; _j++) {
       
   123             $L.script(IriSP.getLib(IriSP.widgetsRequirements[_type].requires[_j]));
       
   124         }
       
   125     }
       
   126     $L.wait(function() {
       
   127         _this.player.loadWidget(_widgetoptions, function(_widget) {
       
   128             _this[_propname] = _widget;
       
   129         });
   121     });
   130     });
   122 }
   131 }
   123 
   132 
   124 /**
   133 /**
   125  * This method responsible of drawing a widget on screen.
   134  * This method responsible of drawing a widget on screen.