Kendo ui 刷新两个剑道网格

Kendo ui 刷新两个剑道网格,kendo-ui,kendo-grid,Kendo Ui,Kendo Grid,我在同一页上有两个剑道网格,上面的网格包含“父”记录,下面的网格在单击父对象时显示父对象的“子对象” 当我对父项执行操作时,我希望a更新受影响的父项和子项记录的数据库,b在父项网格中重新加载数据,然后c在子项网格中重新加载数据 我可以做a和b,但c不行 以下是我的功能: // Restore a Soft-Deleted person var processRestoreURL = crudServiceBaseUrl + '?method=restorePerson'; function re

我在同一页上有两个剑道网格,上面的网格包含“父”记录,下面的网格在单击父对象时显示父对象的“子对象”

当我对父项执行操作时,我希望a更新受影响的父项和子项记录的数据库,b在父项网格中重新加载数据,然后c在子项网格中重新加载数据

我可以做a和b,但c不行

以下是我的功能:

// Restore a Soft-Deleted person
var processRestoreURL = crudServiceBaseUrl + '?method=restorePerson';
function restorePerson(id, row){
    if (confirm('#getResource("person.detail.confirmrestore")#')) {
        $.ajax({
            type: 'POST',
            url: processRestoreURL,
            data: {
                PERS_KY: id
            },
            success: function (data){
                // Refresh the datasource so the row updates itself
                $("#list").data("kendoGrid").dataSource.read();

                // TO DO: Make the Organisation tab reload with the restored data
                $("#organisationGrid").data("kendoGrid").dataSource.read();
                    // doesn't work :-(
                    // Seems to execute BEFORE the datasource refresh
                    // Maybe I just need to reload the tab here, no need to reread the datasource?


            },
            error: function (xhr, textStatus, errorThrown){
                alert("Error while restoring person"+ "\n"+ xhr + "\n"+ textStatus + "\n" + errorThrown);
            }
        });
    }
}
如何让OrganizationGrid刷新

编辑
下面是一个简单的演示,希望向您展示如何做到这一点:

重要位是第一个网格中的该位:

  dataBound: function (e) {
      console.log(e);

      reboundTimes = reboundTimes + 1;

      $('#newConsole').html('<strong>rebinding child grid now: have done this: ' + reboundTimes + ' time(s)</strong>');
      $('#grid2').data('kendoGrid').dataSource.read();
  },
所有这一切都是在触发数据绑定事件后进行的,它将记录到控制台,以向您显示事件已完成的操作,并增加一个计数器以向您显示这是在触发事件

一旦触发,它就会调用第二个网格,然后触发数据源上的读取事件


任何问题都让我知道

您是否尝试使用父网格上的数据绑定事件刷新子网格?如果不是这样,那么在父网格的数据源中发生的任何更改都应该触发一个请求,为您重新绑定子网格。如果你需要一个例子,我很乐意提供一个。。。是的,请!那太好了!实际上,关于数据绑定的事情,父网格已经有了一个数据绑定属性,该属性调用一个单独的函数dataBoundFunction,该函数执行一系列其他的工作。你会猜到我现在正在研究遗留代码。该功能是在编辑我的原始文章。也许您可以建议对其进行更改,以刷新我的组织网格?
  dataBound: function (e) {
      console.log(e);

      reboundTimes = reboundTimes + 1;

      $('#newConsole').html('<strong>rebinding child grid now: have done this: ' + reboundTimes + ' time(s)</strong>');
      $('#grid2').data('kendoGrid').dataSource.read();
  },