在 ajax 成功部分使方法异步
Make method asynchronius in ajax success section
我有以下 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 grid.
当我们使用refreshContent方法时,会触发ejGrid的actionComplete事件。在这种情况下,您可以使用参数将 requestType 检查为 refresh 以实现您的要求。
关于actionComplete事件和refreshContent方法的详细信息,请参考以下文档。
https://help.syncfusion.com/api/js/ejgrid#events:actioncomplete
https://help.syncfusion.com/api/js/ejgrid#methods:refreshcontent
如果您仍然遇到任何复杂问题,请回复我并提供以下详细信息。
- 在 renameconditiontype() 函数中,您是在更改列名还是列的数据源。
- 调用gridRefreshContent()方法后是否需要维护renameconditiontype()方法的结果
- 分享网格代码示例
我有以下 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 grid.
当我们使用refreshContent方法时,会触发ejGrid的actionComplete事件。在这种情况下,您可以使用参数将 requestType 检查为 refresh 以实现您的要求。
关于actionComplete事件和refreshContent方法的详细信息,请参考以下文档。
https://help.syncfusion.com/api/js/ejgrid#events:actioncomplete
https://help.syncfusion.com/api/js/ejgrid#methods:refreshcontent
如果您仍然遇到任何复杂问题,请回复我并提供以下详细信息。
- 在 renameconditiontype() 函数中,您是在更改列名还是列的数据源。
- 调用gridRefreshContent()方法后是否需要维护renameconditiontype()方法的结果
- 分享网格代码示例