easyui datagrid中combobox级联

时间:13-11-27 栏目:EasyUI 作者:zongyan86 评论:0 点击: 6,940 次

大概代码就这样吧。

{                   field: 'project',
                    title: '@Html.DisplayNameFor(model => model.project)',
                    width: 100,
                    sortable: true,
                    align: 'center',
                    editor:
                    {
                        type: 'combobox',
                        options: {
                            valueField: 'name',
                            textField: 'name',
                            url: '../WT_Cost_Fill/GetBox',
                            required: false,
                            panelHeight: 'auto',
                            onSelect: function (rec) {
                                var row = datagrid.datagrid("getSelections");
                                var rowIndex = datagrid.datagrid('getRowIndex', row[0]);
                                var target = $('#dg').datagrid('getEditor', { 'index': rowIndex, 'field': 'childrenproject' }).target;
                                target.combobox('clear');
                                var url = '../WT_Cost_Fill/GetChildrenBox?project=' + rec.id + '&random=' + Math.random();
                                target.combobox('reload', url);
                            }
                            
                        }
                    }
                }, {
                    field: 'childrenproject',
                    title: '@Html.DisplayNameFor(model => model.childrenproject)',
                    width: 100,
                    sortable: true,
                    align: 'center',
                    editor:
                    {
                        type: 'combobox',
                        options: {
                            valueField: 'name',
                            textField: 'name',
                            required: false,
                            panelHeight: 'auto'
                        }
                    }
                }

web前端开发

参考:http://runjs.cn/code/7cscv7os



声明: 本文由( zongyan86 )原创编译,转载请保留链接: easyui datagrid中combobox级联


热搜关键词: easyui   开发   web开发
广告虚位以待

关注我们