0

使用 APEX 18.2。当模型发生特定更改时,我正在收听 IG 的网格模型以设置发票的净金额项目,使用以下代码:

(function($) {

 $(function() {
/*gRegionStaticId is the variable hodlds the IG that owns the model. */
  $(gRegionStaticId).on("interactivegridviewmodelcreate", function(event, ui) {
   var sid,
    model = ui.model;
   console.log('modelCreated');
   if (ui.viewId === "grid") {
    sid = model.subscribe({
     onChange: function(type, change) {
      if (type !== "set" && type !== "move" && type !== "metaChange" && type !== "insert" && type !== "clearChanges") {
  /*"pFlowStepId" is page's number. gSetNetAmount is the global variable holds the function to set net amount.*/
$s("P" + $v('pFlowStepId') + "_NET_AMOUNT", gSetNetAmount().toString());
          //alert('&APP_PAGE_ID');
      }
     }
    });
   }
  });
 });

})(apex.jQuery);

File URLs代码存储在从页面属性调用的静态文件中。gRegionStaticId 和 gSetNetMaount 是定义的全局变量,并分配了拥有我正在收听的模型的 IG 的静态 id 以及在Function and global variables页面属性中分别计算净额的函数。我这样做是为了动态使用代码,而不是在多个页面中复制它。问题(我认为)是File URL使用上述代码加载静态文件的属性在Function and global variables页面属性设置全局变量之前运行。

有没有办法在加载静态文件之前设置变量?或者也许将值传递给静态文件?

4

1 回答 1

0

我解决了。我给该区域一个 css 类,并在我上面提到的静态文件中引用它以及关于净额计算功能。

gSetNetAmount = itemTotal;Execute when page loads页面属性中声明变量后,我在页面属性中为变量 gSetNetAmount 分配了函数名称Function and global variables declaration。而且效果很好。谢谢@Salim。

于 2020-06-04T00:57:28.393 回答