【发布时间】:2019-04-01 13:55:59
【问题描述】:
我有一个包含一堆记录的交互式网格,我想在页面上设置一个按钮来更改当前选择的所有记录中的一列。
运行 APEX 18.2,IG 有一大堆列,我想只更改其中一个,但在一大堆行上,所以我确实需要一个按钮。 IG 将 ROWID 作为 PK,因为实际的 PK 由 4 个不同的列组合而成。
我花了一些时间在谷歌上搜索这个问题,并找到了几个有解决方案的人:
http://thejavaessentials.blogspot.com/2017/03/getting-selected-rows-in-oracle-apex.html
这是第一个也是最简单的解决方案。但它不返回任何 rowid 或类似的东西,它返回第一列中的值。
然后我也找到了
http://apex-de.blogspot.com/2018/09/update-several-rows-in-tabular-form-grid.html
和
https://ruepprich.wordpress.com/2017/03/23/bulk-updating-interactive-grid-records/
这很相似,似乎对我来说是最好的,但我在控制台中收到 Javascript 错误:http://prntscr.com/n5wvqj
而且我真的不太懂 Javascript,所以我不知道出了什么问题或如何最好地解决它。
我在按钮单击时设置了一个执行 Javascript 的动态操作,并且我选择的元素是名为 CUR_STAT 的区域。
var 记录;
//识别特定的交互式网格
var ig$ = apex.region("CUR_STAT").widget();
//Fetch the model for the interactive grid
var grid = ig$.interactiveGrid("getViews","grid");
//Fetch the model for the interactive grid
var model = ig$.interactiveGrid("getViews","grid").model;
//Fetch selected records
var selectedRecords = apex.region("CUR_STAT").widget().interactiveGrid("getViews","grid").view$.grid("getSelectedRecords");
//Loop through selected records and update value of the AVT_OBR column
for (idx=0; idx < selectedRecords.length; idx++)
{
//Get the record
record = model.getRecord(selectedRecords[idx][0]);
// set Value for column AVT_OBR on "D"
model.setValue(record,"AVT_OBR", 'D');
}
名为 AVT_OBR 的列是一个选择列表,具有显示值 (DA, NE) 和返回值 (D, N)。但我尝试让它成为一个文本字段,但没有帮助。
我希望能够选择多个列并更改这些条目中的数据。
如果可能的话,我还希望能够以这种方式在隐藏列中更改数据。或者,如果我可以获取所选记录的所有 ROWID 并使用它们执行 PLSQL 块。
【问题讨论】:
标签: oracle-apex