$.extend($.fn.datagrid.defaults.editors, { datetimebox: { init: function(container, options){ var editor= $('<input/>').appendTo(container); options.editable = false;//文本框变成时间框不能让用户输入,不然出错,必须加上该属性 editor.datatimebox(options);//把editor初始化成datatimebox时间框 return editor; }, getValue: function(target){ // return $(target).val(); //这么写是得到普通文本框的值,easyui的几个框都有本身的setValue和getValue方法 return $(target).datetimebox('getValue'); }, setValue: function(target, value){ //$(target).val(value); $(target).datetimebox('setValue'); }, resize: function(target, width){ /* var input = $(target); if ($.boxModel == true){ input.width(width - (input.outerWidth() - input.width())); } else { input.width(width); } */ $(target).datetimebox('resize',width);//datetimebox控件的方法 }, destory:function(target){ $(target).datetimebox('destroy');//销毁datetimebox的下拉面板控件,input框不须要 } } });