I am working on an Oracle APEX application with an Interactive Grid (IG). When the user submits or saves the IG, I want to perform the following actions:
Insert the IG rows into a custom table based on the IG data before saving. If there's a problem or validation error, reload the grid and avoid saving the data. Currently, I am using a Dynamic Action on the "Before Page Submit" event to:
Loop through all rows in the IG. Insert the IG data into an APEX collection. Process the data from the collection into my tables. However, I am encountering the following issue:
Problem: Sometimes, the page is submitted before all the data from the Interactive Grid is inserted into the APEX collection, resulting in exceptions and partial data processing. What I Have Tried: I ensured the Dynamic Action runs before the page submission. Added server-side processes to handle the data in the collection. My Questions: How can I ensure that all the rows from the IG are processed into the APEX collection before the page is submitted? Is there a way to delay or pause the submit action until the collection processing is complete? Example Code: Here’s a snippet of the JavaScript I use to loop through the IG rows and insert them into the collection:
apex.server.process("CLEAR_PaymentVoucherJournal_COLLECTION");
var model = apex.region("my_ig").widget().interactiveGrid("getViews",
"grid").model;
var rows = model.getRecords();
rows.forEach(function(row) {
// Logic to add rows to collection
apex.server.process("ADD_TO_COLLECTION", {
x01: row.values.COLUMN_NAME1,
x02: row.values.COLUMN_NAME2
});
});
Expected Behavior: All IG rows should be added to the collection before the page submits. If any errors occur during processing, the page should reload or cancel submission. Actual Behavior: The page sometimes submits before all rows are added to the collection, causing exceptions.
Would appreciate any insights or solutions for ensuring proper synchronization between IG processing and page submission. Thank you!
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742407233a4438096.html
评论列表(0条)