I created two custom JQuery UI widgets with same name but with different namespaces as given below: First widget:
$.widget(\'finance.dialog\',{....}); // this wa
I think these two functions can help in such case. The first load a widget by pointing to the function created by JQ on the namespace object. The second use the name directly which I think will not be conflict as long as name is unique.
/**
* Apply the JQuery UI widget on an element with the given selector
* @param {String} emSelector selector
* @param {String} namespace widget namespace
* @param {String} widgetName widget name
* @param {Object}[options] options options object or null
*/
jqUIWidgetByNSAndName:function(emSelector, namespace, widgetName, options) {
var em = $(emSelector);
$[namespace][widgetName].call(em, options, em);
},
/**
* Apply the JQuery UI widget on an element with the given selector
* @param {String} emSelector selector
* @param {String} widgetName widget name
* @param {Object}[options] options options object or null
*/
jqUIWidgetByName:function (emSelector, widgetName, options) {
var em = $(emSelector);
$.fn[widgetName].call(em, options);
}
//Example1 - with namespace
this.jqUIWidgetByNSAndName("#abc", "cg", "WebsiteGlass", options);
//Example2 - without namespace
this.jqUIWidgetByName("#abc", "WebsiteGlass", options);