admin管理员组文章数量:1394184
I am using Ag Grid v11.0 with angular 1.x. After the grid is rendered, I want to make an action ( ex: save the grid items ) changing the overlayLoadingTemplate property in order to display a different message ( ex: Saving ... please wait ).
$scope.save = save;
var _overlayLoadingTemplate = '<span class="ag-overlay-loading-center">Please wait while your items are loading</span>';
var _overlaySaveTemplate = '<span class="ag-overlay-loading-center">Saving...</span>';
$scope.gridOptions = {
columnDefs: columnDefs,
rowData: [/*stuff*/],
overlayLoadingTemplate: _overlayLoadingTemplate,
};
function save () {
$scope.gridOptions.overlayLoadingTemplate = _overlaySaveTemplate;
$scope.gridOptions.api.showLoadingOverlay();
/* call service and get response logic here */
$scope.gridOptions.api.hideOverlay();
}
The overlayLoadingTemplate property is not being changed, is the initial one: _overlayLoadingTemplate. I didn't find any set methods like setOverlayLoadingTemplate
I am using Ag Grid v11.0 with angular 1.x. After the grid is rendered, I want to make an action ( ex: save the grid items ) changing the overlayLoadingTemplate property in order to display a different message ( ex: Saving ... please wait ).
$scope.save = save;
var _overlayLoadingTemplate = '<span class="ag-overlay-loading-center">Please wait while your items are loading</span>';
var _overlaySaveTemplate = '<span class="ag-overlay-loading-center">Saving...</span>';
$scope.gridOptions = {
columnDefs: columnDefs,
rowData: [/*stuff*/],
overlayLoadingTemplate: _overlayLoadingTemplate,
};
function save () {
$scope.gridOptions.overlayLoadingTemplate = _overlaySaveTemplate;
$scope.gridOptions.api.showLoadingOverlay();
/* call service and get response logic here */
$scope.gridOptions.api.hideOverlay();
}
The overlayLoadingTemplate property is not being changed, is the initial one: _overlayLoadingTemplate. I didn't find any set methods like setOverlayLoadingTemplate
Share Improve this question asked Jul 12, 2017 at 16:17 que1326que1326 2,3254 gold badges43 silver badges59 bronze badges2 Answers
Reset to default 3It is possible. I needed to change text in the overlay template of the child grid in a master-detail scenario.
In your overlay template, create placeholder elements that you swap out with content right before you call showLoadingOverlay
$scope.save = save;
var _overlayLoadingTemplate = '<span class="ag-overlay-loading-center"><span id="js-overlay-text">Please wait while your items are loading...</span></span>';
$scope.gridOptions = {
columnDefs: columnDefs,
rowData: [/*stuff*/],
overlayLoadingTemplate: _overlayLoadingTemplate,
};
function save () {
document.getElementById("js-overlay-text").innerText = "Saving...";
$scope.gridOptions.api.showLoadingOverlay();
/* call service and get response logic here */
$scope.gridOptions.api.hideOverlay();
}
The overlays cannot be updated in the way that you want I'm afraid. The Loading Overlay and the No Rows Overlay can be changed from the default, but this is done at initialisation time and cannot be changed again.
If you wish to display application specific overlays I'm afraid you'll need to provide an implementation of this yourself.
本文标签: javascriptHow to change the overlayLoadingTemplate in ag GridStack Overflow
版权声明:本文标题:javascript - How to change the overlayLoadingTemplate in ag Grid? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744708628a2620990.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论