Kendo GRID - 点击“添加新行”按钮后获取kendo网格Uncaught TypeError:无法读取'name'属性null

时间:2014-11-26 16:46:10

标签: javascript jquery kendo-ui kendo-grid

我尝试使用以下设置在Kendo Grid中添加新行:

costCategory: {
                editable: true,
                nullable: false,
                defaultValue: {},
                type: "object"
              },

可编辑设置为:

editable:{
        //mode: 'inline',
        //confirmation:false //remove delete confirm message
      },

但点击"添加新行"按钮我总是得到以下错误消息;

Uncaught TypeError: Cannot read property 'name' of null


Uncaught TypeError: Cannot read property 'name' of nullVM6703:3 (anonymous function)jquery.js:547 proxykendo.all.min.js:24 N.ui.DataBoundWidget.extend._rowsHtmlkendo.all.min.js:24 N.ui.DataBoundWidget.extend._renderContentkendo.all.min.js:24 N.ui.DataBoundWidget.extend.refreshjquery.js:547 proxykendo.all.min.js:9 n.extend.triggerkendo.all.min.js:11 ct.extend._processkendo.all.min.js:11 ct.extend._changejquery.js:547 proxykendo.all.min.js:9 n.extend.triggerkendo.all.min.js:10 ct.extend.splicekendo.all.min.js:11 ct.extend.insertkendo.all.min.js:23 N.ui.DataBoundWidget.extend.addRowkendo.all.min.js:23 (anonymous function)jquery.js:4641 jQuery.event.dispatchjquery.js:4309 elemData.handle

是否可以在列中产生值?

  {
          field :"costCategory.name",
          title : $translate.instant('COSTCATEGORY'),
          width: "200px",
          editor: GlobalHelperService.getCostCategoryForAutocomplete,
          filterable: {
            cell: {
              operator: "contains"
            }
          }
        },

感谢您的任何建议。

1 个答案:

答案 0 :(得分:2)

你能试试吗?

costCategory: {
                editable: true,
                nullable: false,
                defaultValue: {"name" : ""},
                type: "object"
              },