我试图在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"
            }
          }
        },


感谢您的任何建议。

最佳答案

你可以试试这个吗?

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

09-25 17:51