你能动态覆盖ag网格balham主题光标吗



我正在尝试将css属性游标动态更改为"等待";而应用程序执行api调用。我添加了

document.body.style.cursor = "wait";

在ajax之前,但它不会在我的ag网格上生效。我的猜测是ag网格balham类覆盖了cursor属性。我怎么能强迫我凌驾于巴伦之上呢?

您可以。通过使用自定义类,它可以轻松覆盖AGGRID的样式。

create a class like this 
.custom-wait-class .ag-root-wrapper,
.custom-wait-class .ag-side-button-button{
cursor : wait !important;
}

然后在进行数据加载时添加/删除此类。

var eGridDiv = document.querySelector('#myGrid');
eGridDiv.classList.add('custom-wait-class');
// create the grid passing in the div to use together with the columns & data we want to use
new agGrid.Grid(eGridDiv, gridOptions);
agGrid.simpleHttpRequest({url: 'https://raw.githubusercontent.com/ag-grid/ag-grid/master/grid-packages/ag-grid-docs/src/sample-data/rowData.json'}).then(function(data) {
gridOptions.api.setRowData(data);

//remove class here 
eGridDiv.classList.remove('custom-wait-class')
});

这是演示plunkr

最新更新