Oracle Apex 5.0 使用 JavaScript 为项目设置值
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/32604774/
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
Oracle Apex 5.0 Set Value To Item using JavaScript
提问by Mahmoud Momani
I built an interactive report based on View That Contains the master & details data, and I used Column Break To let the Report makes sense, and I used The master ID as a link to report that I built using FO Designer, so I used a hidden Item to set the ID value in it, and to print the report based on this value.
我基于包含主数据和详细数据的视图构建了一个交互式报表,并且我使用了分栏符来让报表有意义,并且我使用主 ID 作为我使用 FO Designer 构建的报表的链接,所以我使用了hidden Item 在其中设置 ID 值,并根据该值打印报告。
So I used a dynamic action to set the value from the record (using $s('P50_NEW',this.triggeringElement.id)). but the value didn't stored in the Item (The Session State), and I stuck here.
所以我使用动态操作来设置记录中的值(使用 $s('P50_NEW',this.triggeringElement.id))。但是该值没有存储在 Item(会话状态)中,我就卡在这里了。
Please Can anyone help me how to do it please, and how to make apex to set the session state at first then print the report.
请任何人都可以帮助我如何做到这一点,以及如何让顶点首先设置会话状态然后打印报告。
Thanks.
谢谢。
回答by learningloop
As per the API Reference, the $s('P50_NEW',this,triggeringElementId)
doesn't set the value in session state. The scope of $s(...)
setting is for the current page, not for the session.
根据API Reference,$s('P50_NEW',this,triggeringElementId)
不会在会话状态中设置值。$s(...)
设置范围是针对当前页面,而不是针对会话。
In order to set the value in session, you can invoke apex.server.process
API to set the value in session.
为了在 session 中设置值,您可以调用apex.server.process
API 来设置 session 中的值。
So, the updated Javascript for Dynamic Execution will be like the following:
因此,更新后的动态执行 Javascript 将如下所示:
$s('P50_NEW',this.triggeringElement.id);
apex.server.process ( "SAVE_HIDDEN_VALUE_IN_SESSION_STATE", {
x01: "set_session_state",
pageItems: "#P50_NEW"
}, {dataType: 'text'} );
回答by Valentine Nikitsky
If you would need to set session state to use the value in a report SQL source, the simplest solution would be to specify the item name in the report Page Items to Submit
attribute and refresh the report:
如果您需要设置会话状态以使用报告 SQL 源中的值,最简单的解决方案是在报告Page Items to Submit
属性中指定项目名称并刷新报告:
apex.item( "P50_NEW" ).setValue (this.triggeringElement.id);
apex.jQuery('#Report').trigger('apexrefresh');
(assuming that the report Static ID
is Report)
(假设报告Static ID
为Report)