easyui datagrid editors扩展之combogrid

来源:互联网 发布:windows脚本 编辑:程序博客网 时间:2024/05/19 03:23

定义:

01$.extend($.fn.datagrid.defaults.editors, {
02    combogrid: {
03        init: function(container, options){
04            var input = $('<input type="text" class="datagrid-editable-input">').appendTo(container);
05            input.combogrid(options);
06            return input;
07        },
08        destroy: function(target){
09            $(target).combogrid('destroy');
10        },
11        getValue: function(target){
12            return $(target).combogrid('getValue');
13        },
14        setValue: function(target, value){
15            $(target).combogrid('setValue', value);
16        },
17        resize: function(target, width){
18            $(target).combogrid('resize',width);
19        }
20    }
21});

 

用法:

view source
print?
01$('#dg').datagrid({
02    columns:[[
03        {field:'productid',name:'ProductId',width:100,
04            editor:{
05                type:'combogrid',
06                options:{
07                    panelWidth:450,
08                    idField:'code',
09                    textField:'name',
10                    url:'datagrid_data.json',
11                    columns:[[
12                        {field:'code',title:'Code',width:60},
13                        {field:'name',title:'Name',width:100},
14                        {field:'addr',title:'Address',width:120},
15                        {field:'col4',title:'Col41',width:100}
16                    ]]
17                }
18            }
19        }
20    ]]
21});
原创粉丝点击