This is the skeleton to create a new multibox component based on combo.
(function($){
function create(target){
var state = $.data(target, 'multibox');
var opts = state.options;
$(target).addClass('multibox-f');
$(target).combo($.extend({}, opts, {
}));
}
$.fn.multibox = function(options,param){
if (typeof options == 'string'){
var method = $.fn.multibox.methods[options];
if (method){
return method(this, param);
} else {
return this.combo(options, param);
}
}
options = options || {};
return this.each(function(){
var state = $.data(this, 'multibox');
if (state){
$.extend(state.options, options);
} else {
state = $.data(this, 'multibox', {
options: $.extend({}, $.fn.multibox.defaults, $.fn.combo.parseOptions(this), options)
});
}
create(this);
});
};
$.fn.multibox.defaults = $.extend({}, $.fn.combo.defaults, {
});
$.fn.multibox.methods = {
options: function(jq){
var copts = jq.combo('options');
return $.extend($.data(jq[0], 'multibox').options, {
width: copts.width,
height: copts.height,
originalValue: copts.originalValue,
disabled: copts.disabled,
readonly: copts.readonly
});
}
}
})(jQuery);