Saturday, 14 September 2013

function gets undefined with jquery widget factory plugin

function gets undefined with jquery widget factory plugin

Im creating an plugin using jquery widget factory an i'm stuck on a
function that seems to be undefined.
(function ($, undefined) {
$.widget("cms.treeview", {
options: {
url: ""
},
_create: function () {
//--- Requesting data
this._requestData(this.options.url);
},
_requestData: function (url) {
$.ajax({
url: url,
dataType: "json",
contentType: "application/json charset=utf-8",
success: this._requestReady
});
},
_requestReady: function (data) {
//--- Create the treeview root nodes
this._createTree(data, null, this.element);
// ERROR : TypeError: this._createTree is not a function
},
//--- create root tree
_createTree: function (nodes, parentId, container) {
// . . .
}
});
})(jQuery);
It might be something easy just can get this to work, can someon help with
this?
/Martin

No comments:

Post a Comment