我想禁用Stimulsoft报表工具栏上的所有控件。在文档中,我找到了类似的选项
var options = new Stimulsoft.Viewer.StiViewerOptions();
options.toolbar.visible = false; // to hide toolbar
options.toolbar.showOpenButton = false; // to hide open button
var viewer = new Stimulsoft.Viewer.StiViewer(options, 'StiViewer', false);
viewer.report = report;
viewer.renderHtml('viewer');
但是我不想隐藏工具栏的行为或它的特定控件,我只希望禁用并显示控件。
我在stimulsoft的文档中找不到任何解决方案。所以我只是通过使用CSS禁用指针事件来解决此问题。
Array.prototype.map.call(document.querySelectorAll(".stiJsViewerToolBarTable td"), (element) => {
const smlButton = element.querySelector('div')
if (smlButton) smlButton.style = "margin-right:3px; margin-left:1px;";
element.style = "opacity: 0.8; pointer-events: none; cursor: not-allowed !important;"
})