在ajax成功部分中使方法异步

问题描述 投票:0回答:1

我有以下ajax脚本。

$.ajax({
  url: url,
  type: "DELETE",
  dataType: "text",
  success: function (data) {
    var grid = $('#rolesgrid').ejGrid("instance");
    grid.refreshContent();
    $('#rolesgrid_delete').css('visibility', 'hidden');
    renameConditionType(grid);     
  },
  error: function (xhr, textStatus, errorThrown) {
    showDialogMessage('Page error', errorThrown, 'danger');
  }  
});

当我通过调用函数grid.refreshContent()提出请求时。调用下一个函数renameConditionType(grid)。第二个特定列的更改上下文。

当函数grid.refreshContent()的请求完成时。它覆盖了函数renameConditionType(grid)的结果。

如何从功能grid.refreshContent()请求时等待。我使用syncfusion javascript网格。

jquery ajax asp.net-ajax syncfusion
1个回答
0
投票

当我们使用refreshContent方法时,将触发ejGrid的actionComplete事件。在这种情况下,您可以使用参数将requestType检查为刷新以满足您的要求。

有关actionComplete事件和refreshContent方法的详细信息,请参阅以下文档。

https://help.syncfusion.com/api/js/ejgrid#events:actioncomplete

https://help.syncfusion.com/api/js/ejgrid#methods:refreshcontent

如果您仍然遇到任何复杂问题,请通过以下详细信息与我联系。

  1. 在renameconditiontype()函数中,您要更改列的列名称或dataSource。
  2. 在调用gridRefreshContent()方法之后,是否需要维护renameconditiontype()方法的结果?
  3. 分享网格代码示例。
© www.soinside.com 2019 - 2024. All rights reserved.