问题描述
P998_SESS_INFO
是我的经典报告P998_REFRESH
是隐藏项P998_REFRESH_RATE
是具有 STATIC 静态值的 LOV:- 10 秒;10000,
- 20 Sekunden;20000,
- 30 秒;30000
P998_SESS_INFO
is my classic reportP998_REFRESH
is hidden itemP998_REFRESH_RATE
is LOV with static values of STATIC:- 10 Sekunden;10000,
- 20 Sekunden;20000,
- 30 Sekunden;30000
我为
P998_REFRESH
定义了一个 java 脚本表达式类型的动态操作:I define a dynamic action of type java script expression on change set value for
P998_REFRESH
:$x('P998_REFRESH').value = $x('P998_REFRESH_RATE').value;
HTML 标题:
<script type="text/javascript"> var interval = `$`v("P998_REFRESH"); // refresh every 10 seconds setInterval("jQuery('#P998_SESS_INFO').trigger('apexrefresh');", interval); </script>
但这行不通.有什么建议吗?谢谢
but this will not work. Any suggestions available? Thank you
推荐答案
两个问题:
1 - 此代码不会启动项目上的事件更改.(这会更改页面上的值,但不会触发动态操作).而不是这个
1 - this code do not start the event change on item. (this change the value on the page, but not trigger the dynamic action).instead of this
$x('P998_REFRESH').value = $x('P998_REFRESH_RATE').value;
试试这个
$s('P998_REFRESH', $x('P998_REFRESH_RATE').value);
2 - 您需要清除之前的 setInterval 值.设置新的间隔还不够.所以你需要在每次调用 setInterval 时存储在一个变量中
2 - you need to clear the previous setInterval value. it's not enough set new interval. So you need to store in a variable every call to setInterval
var sintervalid = setInterval("jQuery('#P998_SESS_INFO').trigger('apexrefresh');", interval);
并重置
clearInterval(sintervalid); sintervalid = setInterval("jQuery('#P998_SESS_INFO').trigger('apexrefresh');", interval);
如果我要做这样的事情,我会这样尝试:
If I were to do something like this, I would try it like this:
1 - 我在我的 html 标题中创建一个全局变量,设置默认值:
1 - I create one global variable in my html header, setting the default value:
<script type="text/javascript"> var sIntervalId = setInterval(function(){ jQuery('#P998_SESS_INFO').trigger('apexrefresh'); }, 30000); </script>
2 - 我在更改存储间隔的项目时创建一个动态操作
2 - I create a dynamic action when change my item that store the interval
动态动作:更改项目 P998_REFRESH_RATE
dynamic action:change item P998_REFRESH_RATE
真正的行动:执行javascript代码:
true action:execute javascript code:
clearInterval(sIntervalId); sIntervalId = setInterval(function(){ jQuery('#P998_SESS_INFO').trigger('apexrefresh'); }, $x('P998_REFRESH_RATE').value);
***我没有测试过这个,但或多或少会这样.
***I did not test this, but it would be more or less that way.
这篇关于具有可变刷新时间的 APEX 5.1 自动刷新区域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!