Kendo UI 自定义 Kendo 确认确定按钮

don*_*ain 2 kendo-ui kendo-grid

我这里有这个剑道确认功能。当我点击OK它时我想要什么运行这个grid.dataSource.remove(data) grid.dataSource.sync()。谁能帮助我如何实现这一目标?提前致谢。

function(e) { 
  return $("<div></div>").kendoConfirm({
    title: "My Title",
    content: "Are you sure to delete this record?",
    messages:{
      okText: "OK",
      cancel: "Cancel"
    }
  }).data("kendoConfirm").open().result;
  
  // if click OK run this
  // grid.dataSource.remove(data) 
  // grid.dataSource.sync() 	
}
Run Code Online (Sandbox Code Playgroud)

don*_*ain 6

看来剑道确认这里的资源有限。所以我需要更改为 Kendo Dialog 来使用此方法。

function(e) {
  return $("<div></div>").kendoDialog({
    closable: false, // hide X
    title: "My Title",
    content: "Are you sure to delete this record?",
    actions: [{
      text: "OK",
      action: function(e){
        grid.dataSource.remove(data) 
        grid.dataSource.sync() 
        return true;
      },
      primary: true
      },{
        text: "Cancel"
    }]
  }).data("kendoDialog").open().center();
}
Run Code Online (Sandbox Code Playgroud)