(function($) {
function init(_this) {
alert("init");
}
function loadSuccess(_this) {
alert("loadSuccess");
}
$.fn.wgrid = function(method, options) {
// var opts = $.extends(options, $.fn.wgrid.defaults);
if (typeof (method) == "string") {
return $.fn.wgrid.methods[method](this, options);
}else{
//alert(method);
var opts =$.extend({},method,$.fn.wgrid.defaults);
//alert(obj2str(opts));
//alert(opts);
//init();
//loadSuccess();
//$(this).text("aaaaaaaaaaaa");
}
};
$.fn.wgrid.defaults = {
title : 'a',
width : '100%',
height : '100%'
};
$.fn.wgrid.methods = {
a : function(_this, opts) {
alert("a");
},
b : function(_this, opts) {
alert("b");
},
c : function(_this, opts) {
alert("c");
},
d : function(_this, opts) {
alert("d");
}
};
})(jQuery);
调用:
$("#grid").wgrid({title:'sdfsdfdfs'});
$("#grid").wgrid("a",{});