首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用数据网格endEdit数据网格

使用数据网格endEdit数据网格
EN

Stack Overflow用户
提问于 2020-09-20 14:57:53
回答 1查看 31关注 0票数 0

我有一个字段类型为'combogrid‘的数据网格,当我操作'endEdit’行时,它出错了!错误信息:‘未捕获TypeError:无法读取未定义的属性'dc’‘

我的代码如下:

代码语言:javascript
复制
$('#tt').datagrid({
        url: "/hello",
        method: 'get',
        columns: [[
            {field: 'id', title: 'ID', width: '20%'},
            {field: 'name', title: '姓名', width: '20%'},
            {
                field: 'where',
                title: '年份-地址',
                width: '40%',
                editor: {
                    type: 'combogrid',
                    options: {
                        data: addressData,
                        panelWidth: 160,
                        panelHeight: "auto",
                        idField: 'address',
                        textField: 'address',
                        editable: false,
                        columns: [[
                            {field: 'address', title: '编号', width: 60},
                            {field: 'year', title: '名称', width: 100}
                        ]],
                        onSelect: function (index,row) {
                            console.log(row);
                            var row1 = $('#tt').datagrid('getSelected');
                            var index1 = $('#tt').datagrid('getRowIndex',row1);
                            $('#tt').datagrid('endEdit', index1);
                            $("#tt").datagrid("updateRow",{
                                index:index1, //行索引
                                row:{
                                    year:row1.year //行中的某个字段
                                }
                            });
                        },
                        onLoadSuccess: function (a) {
                        }
                    }
                }
            },
            {field: 'year', title: '年份', width: '20%', align: 'center'}
        ]]

})

行出错:'$('#tt').datagrid('endEdit',index1);‘

EN

回答 1

Stack Overflow用户

发布于 2020-09-20 15:40:12

将'onSelect‘替换为'onClickRow',就可以了!

代码语言:javascript
复制
onClickRow: function (index, row) {}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/63976336

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档