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);
}
}

發佈了63 篇原創文章 · 獲贊 0 · 訪問量 7090
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章