现在的位置: 首页 > 综合 > 正文

jQuery EasyUI — 重写datagrid的datetimebox编辑类型

2017年12月02日 ⁄ 综合 ⁄ 共 630字 ⁄ 字号 评论关闭

(1)重写datetimebox定义代码:

// 重写datetimebox
$.extend($.fn.datagrid.defaults.editors, {
	datetimebox : {
		init : function(container, options) {
			var box = $('<input />').appendTo(container);
			box.datetimebox(options);
			return box;
		},
		getValue : function(target) {
			return $(target).datetimebox('getValue');
		},
		setValue : function(target, value) {
			$(target).datetimebox('setValue', value);
		},
		resize : function(target, width) {
			var box = $(target);
			box.datetimebox('resize', width);
		},
		destroy : function(target) {
			$(target).datetimebox('destroy');
		}
	}
});

(2)调用代码:

{field:'fieldName',title:'标题',width:140,align:'center',sortable:true,hidden:false,editor:{
	type:'datetimebox' , 
	options:{
		editable:false 
	}
}}

抱歉!评论已关闭.