/**
* The Patch for jQuery EasyUI 1.4.1
*/
(function($){
function setMe(target){
var opts = $(target).textbox('options');
var tb = $(target).next();
tb.removeClass('textbox-disabled textbox-readonly');
if (opts.readonly){tb.addClass('textbox-readonly')}
if (opts.disabled){tb.addClass('textbox-disabled')}
}
var plugin = $.fn.textbox;
$.fn.textbox = function(options, param){
if (typeof options != 'string'){
return this.each(function(){
plugin.call($(this), options, param);
setMe(this);
})
} else {
return plugin.call(this, options, param);
}
};
$.fn.textbox.methods = plugin.methods;
$.fn.textbox.defaults = plugin.defaults;
$.fn.textbox.parseOptions = plugin.parseOptions;
var enable = $.fn.textbox.methods.enable;
$.fn.textbox.methods.enable = function(jq){
return jq.each(function(){
enable.call($.fn.textbox.methods, $(this));
$(this).next().removeClass('textbox-disabled');
});
return enable.call($.fn.textbox.methods, jq);
};
var disable = $.fn.textbox.methods.disable;
$.fn.textbox.methods.disable = function(jq){
return jq.each(function(){
disable.call($.fn.textbox.methods, $(this));
$(this).next().addClass('textbox-disabled');
});
};
var readonly = $.fn.textbox.methods.readonly;
$.fn.textbox.methods.readonly = function(jq, mode){
return jq.each(function(){
readonly.call($.fn.textbox.methods, $(this), mode);
var tb = $(this).next();
tb.removeClass('textbox-readonly');
if ($(this).textbox('options').readonly){
tb.addClass('textbox-readonly');
}
});
}
$.extend($.fn.textbox.methods, {
setValue: function(jq, value){
return jq.each(function(){
var opts = $.data(this, 'textbox').options;
var oldValue = $(this).textbox('getValue');
$(this).textbox('initValue', value);
if (oldValue != value){
opts.onChange.call(this, value, oldValue);
$(this).closest('form').trigger('_change', [this]);
}
});
}
});
})(jQuery);
(function($){
function setMe(target){
var p = $(target).combo('panel');
p.panel('options').onClose = function(){
var target = $(this).panel('options').comboTarget;
var state = $(target).data('combo');
if (state){
state.options.onHidePanel.call(target);
}
}
}
var plugin = $.fn.combo;
$.fn.combo = function(options, param){
if (typeof options != 'string'){
return this.each(function(){
plugin.call($(this), options, param);
setMe(this);
});
} else {
return plugin.call(this, options, param);
}
};
$.fn.combo.methods = plugin.methods;
$.fn.combo.defaults = plugin.defaults;
$.fn.combo.parseOptions = plugin.parseOptions;
$.extend($.fn.combo.methods, {
setValue: function(jq, value){
return jq.each(function(){
$(this).combo('setValues', [value]);
})
},
setValues: function(jq, values){
return jq.each(function(){
var target = this;
var state = $.data(target, 'combo');
var opts = state.options;
var combo = state.combo;
if (!$.isArray(values)){values = values.split(opts.separator)}
var oldValues = $(target).combo('getValues');
combo.find('.textbox-value').remove();
var name = $(target).attr('textboxName') || '';
for(var i=0; i<values.length; i++){
var input = $('<input type="hidden" class="textbox-value">').appendTo(combo);
input.attr('name', name);
if (opts.disabled){
input.attr('disabled', 'disabled');
}
input.val(values[i]);
}
var changed = (function(){
if (oldValues.length != values.length){return true;}
var a1 = $.extend(true, [], oldValues);
var a2 = $.extend(true, [], values);
a1.sort();
a2.sort();
for(var i=0; i<a1.length; i++){
if (a1[i] != a2[i]){return true;}
}
return false;
})();
if (changed){
if (opts.multiple){
opts.onChange.call(target, values, oldValues);
} else {
opts.onChange.call(target, values[0], oldValues[0]);
}
$(this).closest('form').trigger('_change', [this]);
}
})
}
})
})(jQuery);
(function($){
function setValues(target, values, remainText){
var opts = $.data(target, 'combobox').options;
var panel = $(target).combo('panel');
if (!$.isArray(values)){values = values.split(opts.separator)}
panel.find('div.combobox-item-selected').removeClass('combobox-item-selected');
var vv = [], ss = [];
for(var i=0; i<values.length; i++){
var v = values[i];
var s = v;
opts.finder.getEl(target, v).addClass('combobox-item-selected');
var row = opts.finder.getRow(target, v);
if (row){
s = row[opts.textField];
}
vv.push(v);
ss.push(s);
}
$(target).combo('setValues', vv);
if (!remainText){
$(target).combo('setText', ss.join(opts.separator));
}
}
var query = $.fn.combobox.defaults.keyHandler.query;
$.fn.combobox.defaults.keyHandler.query = function(q){
query.call(this, q);
var opts = $(this).combobox('options');
var vv = $(this).combobox('getValues');
if (!vv.length){
if (opts.multiple && !q){
setValues(this, [], true);
} else {
setValues(this, [q], true);
}
}
}
})(jQuery);
(function($){
var FILE_INDEX = 0;
function buildFileBox(target){
var state = $.data(target, 'filebox');
var opts = state.options;
var id = 'filebox_file_id_' + (++FILE_INDEX);
$(target).addClass('filebox-f').textbox(opts);
$(target).textbox('textbox').attr('readonly','readonly');
state.filebox = $(target).next().addClass('filebox');
state.filebox.find('.textbox-value').remove();
opts.oldValue = "";
var file = $('<input type="file" class="textbox-value">').appendTo(state.filebox);
file.attr('id', id).attr('name', $(target).attr('textboxName')||'');
file.change(function(){
$(target).filebox('setText', this.value);
opts.onChange.call(target, this.value, opts.oldValue);
opts.oldValue = this.value;
});
var btn = $(target).filebox('button');
if (btn.length){
$('<label class="filebox-label" for="'+id+'"></label>').appendTo(btn);
if (btn.linkbutton('options').disabled){
file.attr('disabled', 'disabled');
} else {
file.removeAttr('disabled');
}
}
}
function initCss(){
if (!$('#easyui-filebox-style').length){
$('head').append(
'<style id="easyui-filebox-style">' +
'.filebox-label{display:inline-block;position:absolute;cursor:pointer;left:0;top:0;width:100%;height:100%;z-index:10;}' +
'.l-btn-disabled .filebox-label{cursor:default;}' +
'</style>'
);
}
}
initCss();
var plugin = $.fn.filebox;
$.fn.filebox = function(options, param){
if (typeof options != 'string'){
return this.each(function(){
plugin.call($(this), options, param);
buildFileBox(this);
})
} else {
return plugin.call(this, options, param);
}
};
$.fn.filebox.methods = plugin.methods;
$.fn.filebox.defaults = plugin.defaults;
$.fn.filebox.parseOptions = plugin.parseOptions;
})(jQuery);
(function($){
var plugin = $.fn.form;
$.fn.form = function(options, param){
if (typeof options == 'string'){
return plugin.call(this, options, param);
} else {
return this.each(function(){
plugin.call($(this), options, param);
var opts = $(this).form('options');
$(this).unbind('.form').bind('change.form', function(e){
if (!$(e.target).hasClass('textbox-text')){
if (opts.onChange){
opts.onChange.call(this, e.target);
}
}
}).bind('_change.form', function(e, target){
if (opts.onChange){
opts.onChange.call(this, target);
}
})
});
}
};
$.fn.form.methods = plugin.methods;
$.fn.form.defaults = plugin.defaults;
$.fn.form.parseOptions = plugin.parseOptions;
})(jQuery);
(function($){
function setBodySize(target){
var state = $.data(target, 'datagrid');
var opts = state.options;
var dc = state.dc;
var wrap = state.panel;
var innerWidth = wrap.width();
var innerHeight = wrap.height();
var view = dc.view;
var view1 = dc.view1;
var view2 = dc.view2;
var header1