function rewriteEditor() { //重写numberbox $.extend($.fn.datagrid.defaults.editors, { numberbox: { init: function (container, options) { var input = $('').appendTo(container); if (options && options.ratio) { input.data("ratio", options.ratio); } return input.numberbox(options);; }, destroy: function (target) { $(target).numberbox('destroy'); }, getValue: function (target) { var value = $(target).numberbox('getValue'); var ratio = $(target).data("ratio"); if (ratio) { value = value * ratio; } return value; }, setValue: function (target, value) { var ratio = $(target).data("ratio"); if (ratio) { value = value / ratio; } return $(target).numberbox('setValue', value); }, resize: function (target, width) { $(target).numberbox("resize", width); } } }); //重写编辑器对象 $.extend($.fn.datagrid.defaults.editors, { validatebox: { init: function (container, options) { var input = $('').appendTo(container); return input; }, getValue: function (target) { return $(target).val(); }, setValue: function (target, value) { $(target).val(value); }, resize: function (target, width) { var input = $(target); if ($.boxModel == true) { input.width(width - (input.outerWidth() - input.width())); } else { input.width(width); } } } }); }