Oracle APEX - 显示/隐藏区域

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16760781/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 01:41:27  来源:igfitidea点击:

Oracle APEX - show/hide regions

oracleoracle-apex

提问by Luke G

There are two regions (R1 an d R2) set up on a single page (P1). I would like to show and hide regions based on value of one of the fields from page P1.

在单个页面 (P1) 上设置了两个区域 (R1 和 R2)。我想根据页面 P1 中的一个字段的值显示和隐藏区域。

Could you please point me in the right direction as I am new to APEX and I feel bit lost with all these configuration options.

您能否指出正确的方向,因为我是 APEX 的新手,我对所有这些配置选项感到有些迷茫。

Thanks, Luke

谢谢,卢克

回答by Jeffrey Kemp

The answer depends on whether the field on P1 can be changed dynamically by the user, and if you want the regions to hide/show as the field is changed; or if the field is static (i.e. set once at page load time) and so we only need to show/hide the regions when the page is first loaded.

答案取决于用户是否可以动态更改 P1 上的字段,以及您是否希望在字段更改时隐藏/显示区域;或者如果该字段是静态的(即在页面加载时设置一次),那么我们只需要在页面首次加载时显示/隐藏区域。

  1. If the field is static, you can add a Condition to each of the page regions, e.g. set the region Condition to Value of Item / Column in Expression 1 = Expression 2, put the item name (e.g. P1_MY_ITEM) in Expression 1, and the value to compare it to in Expression 2 (e.g. Y). On the other region, set the region Condition to Value of Item / Column in Expression 1 != Expression 2and set Expression 1 and Expression 2 to the same. (Note: this does not work if the item can be NULL - in which case you will need to use a variation of this to account for NULLs).
  2. If the field is dynamic, you can add a Dynamic Action (Apex 4.0+) to the field which will fire onChange- set the condition for the dynamic action to something like :P1_MY_ITEM='Y'. Set the True action to show one region and hide the other region. Set the False action to do the opposite (hide the first region and show the other).
  1. 如果字段是静态的,您可以为每个页面区域添加一个条件,例如在表达式 1 = 表达式 2中将区域条件设置为项目/列的值,将项目名称(例如 P1_MY_ITEM)放在表达式 1 中,以及将其与表达式 2 中的值进行比较(例如Y)。在另一个区域上,将区域条件设置为表达式 1 中的项目/列的值!= 表达式 2,并将表达式 1 和表达式 2 设置为相同。(注意:如果项目可以为 NULL,这将不起作用 - 在这种情况下,您需要使用它的变体来解释 NULL)。
  2. 如果该字段是动态的,您可以将动态操作(Apex 4.0+)添加到将触发onChange的字段- 将动态操作的条件设置为类似:P1_MY_ITEM='Y'. 设置 True 操作以显示一个区域并隐藏另一个区域。设置 False 操作以执行相反的操作(隐藏第一个区域并显示另一个区域)。