Cod*_*ess 2 oracle-apex oracle-apex-5.1
我正在使用以下方法检索我的网格数据:
var ig$ = apex.region("myGrid1").widget(),
view = ig$.interactiveGrid("getCurrentView");
Run Code Online (Sandbox Code Playgroud)
现在我想检查基于 2 列的特定记录:id1以及id2whereid1 = 1和id2 = 7
我怎么能用javascript做到这一点?
您可以像这样迭代每个记录:
//"myGrid1" should be the static id of the IG region
var widget = apex.region('myGrid1').widget();
var grid = widget.interactiveGrid('getViews','grid');
var model = grid.model;
var results = [];
model.forEach(function(r) {
var record = r;
//the name of the columns should be ID1 and ID2, if not
//make the necessary changes using "_" to represent "space"
var value1 = model.getValue(record,'ID1');
var value2 = model.getValue(record,'ID2');
if(value1 == 1 && value2 == 7) {
results.push(record);
}
})
console.log(results);
Run Code Online (Sandbox Code Playgroud)
要测试此代码,请在控制台上执行它。
要在 chrome 上启动控制台,只需按 F12
祝你好运。
| 归档时间: |
|
| 查看次数: |
4621 次 |
| 最近记录: |