Reputation: 458
I have created plugin which do particular things with data, now I would like somehow join my plugin to use if with ex. jQuery dialog. How can I do this?
this is simplified situation:
(function($) {
$.fn.jquerytoc = function(map, layersConfig, layersList) {
var opts = $.extend($.treeview, $.fn.jquerytoc.defaults, map, layersConfig, layersList);
var TOC = {
map : opts.map,
layersConfig : opts.layersConfig,
TOCinfos : {},
getRequiredData : function() {
},
init : function() {
this.getRequiredData();
}
};
var HTML = {
nodes : TOC.TOCinfos,
data : [],
htmlObject : {},
jqTreeObject : {},
setHTMLcode : function() {
var object = this.data;
var objectNode = {};
var nodes = this.nodes;
console.log(nodes);
for (var node in nodes) {
objectNode = {};
objectNode.label = nodes[node].name;
objectNode.children = [];
var sublayers = nodes[node].sublayers;
for (var sublayer in sublayers) {
objectNode.children.push({
'label' : sublayers[sublayer]
});
};
object.push(objectNode);
};
},
init : function(object) {
this.htmlObject = object;
this.setHTMLcode();
}
};
function init() {
TOC.init();
HTML.init(this);
}
return this.each(function() {
init();
//AND HERE I WOULD LIKE TO WRAP MY DOM ELEMENT WITH JQUERY DIALOG
jQuery.dialog(this);
});
}
})(jQuery);
but I always get that jQuery method dialog is undefined
. I tried it in many ways but always get same error. I would be glad for help! thanks! :)
Upvotes: 1
Views: 48