jQuery EasyUI 重写datagrid的datetimebox编辑类型

简介: jQuery EasyUI 重写datagrid的datetimebox编辑类型

datagrid的编辑框可以为datatimebox或者为datebox如下:

示例如下:

{ field: 'makeDate', title: '编制日期', width: 45,
                    editor:{  
                        type:'datebox' ,   
                        options:{  
                            editable:false   
                        }  
                    }
                }

$.extend($.fn.datagrid.defaults.editors, { 
    datebox : {  
        init : function(container, options) {  
            var box = $('<input />').appendTo(container);  
            options.onSelect=function(){
                var val = box.datebox('getValue');
                //执行相关操作
            }
            box.datebox(options); 
            
            return box;  
        },  
        getValue : function(target) {  
            return $(target).datebox('getValue');  
        },  
        setValue : function(target, value) {  
            $(target).datebox('setValue', value); 
        },  
        resize : function(target, width) {  
            var box = $(target);  
            box.datebox('resize', width);  
        },  
        destroy : function(target) {  
            $(target).datebox('destroy');  
        },
    }  
});  

$.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月前
EasyUI datagrid 从左至右递归合并表格
EasyUI datagrid 从左至右递归合并表格
15 2
|
2月前
EasyUI DataGrid 假分页
EasyUI DataGrid 假分页
15 0
|
2月前
|
前端开发
easyui datagrid 的 tip实现
easyui datagrid 的 tip实现
|
2月前
|
JSON 监控 数据格式
Easy UI datagrid的学习
Easy UI datagrid的学习
|
5月前
|
JSON JavaScript 数据格式
jQuery将json性别数据int类型进行格式化渲染
jQuery将json性别数据int类型进行格式化渲染
26 0
|
5月前
Easyui datagrid 编辑结束时combobox显示value而不显示text
Easyui datagrid 编辑结束时combobox显示value而不显示text
|
5月前
EasyUI中datagrid的行编辑模式中,找到特定的Editor,并为其添加事件
EasyUI中datagrid的行编辑模式中,找到特定的Editor,并为其添加事件
|
5月前
EasyUI DataGrid 可编辑列级联操作
EasyUI DataGrid 可编辑列级联操作
|
5月前
easyUI datagarid 编辑状态下的combobox动态赋值
easyUI datagarid 编辑状态下的combobox动态赋值
|
5月前
easyui datagrid reload后自动全选解决
easyui datagrid reload后自动全选解决

相关课程

更多