Apex Interactive Grid 如何检索特定记录
Apex Interactive Grid how to retrieve a specific record
我正在使用以下方法检索我的网格数据:
var ig$ = apex.region("myGrid1").widget(),
view = ig$.interactiveGrid("getCurrentView");
现在我想根据 2 列检查特定记录:id1
和 id2
其中 id1 = 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);
要测试此代码,请在控制台上执行它。
要在 chrome 启动控制台,只需按 F12
祝你好运。
我正在使用以下方法检索我的网格数据:
var ig$ = apex.region("myGrid1").widget(),
view = ig$.interactiveGrid("getCurrentView");
现在我想根据 2 列检查特定记录:id1
和 id2
其中 id1 = 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);
要测试此代码,请在控制台上执行它。
要在 chrome 启动控制台,只需按 F12
祝你好运。