how can i define the plugin default settings value.. a calculated object or ajax call..
on jquery 1.8.3
hello
this is my first plugin..
how can i define the plugin default settings value.. a calculated object or ajax call..
that cade just not working..
the function on the setting data - not working...
- (function ($) {
- $.fn.treeview = function (options) {
- // plug default virtuals
- var settings = $.extend({
- data: (function () {
- this.data = "i am DATA from pluging default setings";
- //return "i am DATA from pluging default setings";
- }),
- rootName: "none",
- isExpandAll: false,
- isLoadCss: true,
- containerID: null
- }, options)
- function loadTree(callback) {
- if (!settings.data) { alert("treeview plugin data:null"); return; }
- alert(settings.data);
-
- if (callback) callback();
- }
- }
- }(jQuery));
and calling for that plug
- $.getScript("../../../resource/js/lib/treeview/treeview.Plugin.js", function () {
- $.fn.treeview({
- //data: {},
- isExpandAll: false,
- containerID: "xxx"
- });
- }).success(function (e) {
- //alert(1);
- }).fail(function (e) { alert(2); });