Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to delete one row in interactive grid using javascript

SNikiforovApr 17 2023

I tried this code, but it delete all rows in the interactive grid, but i need to delete (or make selected) certain one row.

var l_empno;
var model = apex.region("EMP").widget().interactiveGrid("getViews", "grid").model;
ig$ = apex.region("EMP").widget();
model.forEach(function(igrow) {
if(l_empno == null){
// first row without seperator ":"
l_empno = igrow[model.getFieldKey("EMP_ID")];
}
else {
// add seperator ":" to each additional row
l_empno = l_empno + ':' + igrow[model.getFieldKey("EMP_ID")];
if (igrow[model.getFieldKey("EMP_ID")]=='123')
ig$.interactiveGrid("getActions").invoke("row-delete",igrow);
apex.region("EMP").widget().interactiveGrid("getActions").invoke("refresh");
}
}
);

//

This code also delete all rows:

ig$.interactiveGrid("setSelectedRecords", [2,3]);

Thanks.

Comments
Post Details
Added on Apr 17 2023
3 comments
2,996 views