Cancel the update in inline kendo grid delete the row

戏子无情 提交于 2019-12-04 04:05:16
Osric Xie

I found the error, hope can help you.

If you did not config the dataSource: schema: model's "id" field, when click edit in another row before update or click cancel, it will delete the row.

var dataSource = new kendo.data.DataSource({
        ...
        schema: {
            model: {
                id:"id", // Look here, if you did not config it, issue will happen
                fields: {...
                       ...}
            }
        }   

       ...
})

I have the same issue, and I config cancel like :

...
cancel: function(e) {
           this.refresh();
      },
...

I don't think it's the best way, but it's working.

Hope another people can give us a better way.

after saving I call $('#grid').data('kendoGrid').dataSource.read();

that cancels the edit row and reads any changes.

Still doesn't seem to be fixed. I'm addressing it with 'preventDefault()'. This may require explicit closing of window as a consequence.

    cancel: function (e) {
        // Not sure why this is needed but otherwise removes row...
        e.preventDefault();
        e.container.data("kendoWindow").close();
    },
Amit Jog
schema: {
    model: { id: "StyleNumber" // "Any ID Field from the Fields list" ,
        fields: {

            Qty: { validation: { required: true } },
            Unit: { validation: { required: true } },
            StyleNumber: { validation: { required: true } },
            Description: { validation: { required: true } }
        }
    }
}

This will solve your problem.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!