oracle - Determine the list of IR filter's functions/operators in Oracle APEX 19.1
问题描述
Is there a way to hide some Functions/Operators in the Row Filter of APEX 19.1's Interactive Report? Some end-users get confused with as many functions/operators that they do not used.
Thanks for any considerations.
解决方案
虽然 APEX 不支持开箱即用,但它可以使用 JavaScript。每次显示过滤器对话框时,都会将内容从服务器带到客户端并注入 DOM。您只需要在用户看到之前修改内容。实现此目的的一种方法是使用 MutationObserver 接口:https ://developer.mozilla.org/en-US/docs/Web/API/MutationObserver
以下是您可以执行的一些步骤(在 APEX 19.2 中测试):
- 转到交互式报告并将静态 ID设置为my-irr。
转到页面级属性并将以下代码添加到函数和全局变量声明字段:
function removeIRFilterOperators() { var irRegId = 'my-irr'; var filterOperatorsToRemove = ['!=', 'ABS']; var observer; function detectFilterDialog(mutationsList) { for (var mIdx = 0; mIdx < mutationsList.length; mIdx++) { if (mutationsList[mIdx].addedNodes.length && mutationsList[mIdx].addedNodes[0].classList && mutationsList[mIdx].addedNodes[0].classList.contains('a-IRR-dialog--filter')) { removeOperators(); } } } function removeOperators() { var anchors = document.querySelectorAll('#' + irRegId + '_row_filter_operators a'); for (var aIdx = 0; aIdx < anchors.length; aIdx++) { if (filterOperatorsToRemove.includes(anchors[aIdx].textContent)) { anchors[aIdx].parentElement.parentElement.removeChild(anchors[aIdx].parentElement); } } } observer = new MutationObserver(detectFilterDialog); observer.observe( document, { attributes: false, childList: true, subtree: true } ); } removeIRFilterOperators();
MutationObverver 使用该detectFilterDialog
函数来检测过滤器对话框何时添加到 DOM。发生这种情况时,该removeOperators
函数会从操作员列表中删除指定的选项。您需要做的就是更新filterOperatorsToRemove
数组以包含您要删除的运算符列表。
推荐阅读
- python - 覆盖方法但保留装饰器(python)
- sql-server - 如何查询 msdb.dbo.sysssispackages.packagedata
- python - 熊猫:打印行中具有非零元素的列的名称?
- ffmpeg - FFMPEG - 两个输入,反转第二个输入
- .net - 如何将 .NET Framework 程序集引用添加到 .NET Standard 2.0 项目?
- c++ - 关于类构造方法的简单语法问题
- python - 执行 python 脚本时 Gem5 不工作
- prismic.io - 棱镜:有没有办法在另一个字段中嵌套字段?
- crystal-lang - 为什么 Crystal 无法推断实例变量的类型?
- mysql - MySQL 5.7 Spring JPA 事务管理不起作用