endEdit the datagrid with datagrid

159 Views Asked by At

i have one datagrid with a field type 'combogrid',when i operate 'endEdit' row,it error!error info: 'Uncaught TypeError: Cannot read property 'dc' of undefined'

my code is following:

$('#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'}
        ]]

})

error happened to the line: '$('#tt').datagrid('endEdit', index1);'

1

There are 1 best solutions below

0
107350qin On

replace the 'onSelect' with 'onClickRow',then it will be ok!

onClickRow: function (index, row) {}