APEX Version 24.2
I have an editable interactive grid and a Tree region on page. User can select products from IG or Tree.
There is a Change DA on QTY field in IG which validates stock.
There is a Double Click DA on Tree region which sets PROD_REF in product column IG rest is handled by IG column DA.
If user enter QTY and does not press Tab or Enter and directly Double Clicks on Tree Node, data corruption happens as mentioned below:
- A new blank line is added
- Qty validation fires and shows alert
- Cursor goes back to row which qty was updated, and change values to the new product details which was selected from Tree, hence results in data corruption
What could be the possible solution for this?
Let me know if need more clarification. Thanks
@john-snyders-oracle
Below function is being called on Double Click on Tree Node.
async function insertTreeProduct(pProdRef, pProdCode) {
if (!pProdRef) return;
if (productsList.includes(pProdRef)) {
return apex.message.alert(duplicateProdMsg);
}
const wait = apex.widget.waitPopup();
gridActions$.set("edit", true);
try {
await delay(200);
const row$ = region.widget().find(".a-GV-row").last();
gridView$.grid("setSelection", row$);
if ($v("IG_PRODUCT_REF")) {
gridActions$.invoke("selection-add-row");
}
await delay(500);
if (pProdRef && pProdCode) {
$s("IG_PRODUCT_REF", pProdRef, pProdCode);
}
} catch (error) {
console.error(error);
} finally {
wait.remove();
}
}