jeecg随笔 -- datagrid扩展editor的思路

easy ui 里的 datagrid 要扩展 editor
实际上只需要在现有可用的
text,textarea,checkbox,numberbox,validatebox,datebox,combobox,combotree
里 直接 参照


datetimebox : {
init : function(container, options) {
var editor = $('<input />').appendTo(container);
editor.datetimebox(options);
return editor;
},
destroy : function(target) {
$(target).datetimebox('destroy');
},
getValue : function(target) {
return $(target).datetimebox('getValue');
},
setValue : function(target, value) {
$(target).datetimebox('setValue', value);
},
resize : function(target, width) {
$(target).datetimebox('resize', width);
}
},
multiplecombobox : {
init : function(container, options) {
var editor = $('<input />').appendTo(container);
options.multiple = true;
editor.combobox(options);
return editor;
},
destroy : function(target) {
$(target).combobox('destroy');
},
getValue : function(target) {
return $(target).combobox('getValues').join(',');
},
setValue : function(target, value) {
$(target).combobox('setValues', sy.getList(value));
},
resize : function(target, width) {
$(target).combobox('resize', width);
}
}

进行扩展即可

实际上就是:
在现有的编辑器里, 再加入一些自己需要的属性或者特性
然后 作为一个新的 编辑器 注册进去

以下是我注册的一个仿validatebox,但是增加了禁用编辑的编辑器
暂命名为 inputbox



inputbox : {/* 可以禁用的输入域(实际上是扩展了combobox的功能)*/
init : function(container, options) {
var editor = $('<input />').appendTo(container);
options.hasDownArrow = false;
options.panelHeight = -1;
editor.combobox(options);
return editor;
},
destroy : function(target) {
$(target).combobox('destroy');
},
getValue : function(target) {
return $(target).combobox('getValue');
},
setValue : function(target, value) {
$(target).combobox('setValue', value);
},
resize : function(target, width) {
$(target).combobox('resize', width);
}
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值