Forum Stats

  • 3,741,213 Users
  • 2,248,392 Discussions


How to implement an on-delete dynamic action on an IG?

Eslam_Elbyaly Member Posts: 4,194 Silver Trophy
edited Oct 3, 2019 4:19PM in APEX Discussions


Apex 18.2.

I am trying to execute an action when user deletes an IG record through the "delete row" menu option of "APEX$ROW_ACTION" menu.

I read a thread on the forum before about the same requirement and @John Snyders-Oracle answered with that I have to listen to the model changes(if I remember correctly).

But I found another way and it's working but I want to be sure there is nothing harm could happen in the future.

I inspected the element of the "delete row" menu option and I found that it's id=PI_DTL_ig_row_actions_menu_5i.

PI_DTL is my region's name. So, I created a dynamic action on a jQuery Selector with #PI_DTL_ig_row_actions_menu_5i and made the event scope=dynamic without mentioning a jQuery selector container and it works fine. As I just said, I I want to be sure there is nothing wrong with such an implementation.



  • Fernando Lima
    Fernando Lima Member Posts: 125 Red Ribbon
    edited Sep 16, 2019 3:13PM

    It is possible that the method works good, but you a using the jquery selector to made it, but, if apex get a new realise and the selectors change, then your method could fail.

    I try not use the client side methods, because they could change with new realises caused by the new libraries.

  • Eslam_Elbyaly
    Eslam_Elbyaly Member Posts: 4,194 Silver Trophy
    edited Sep 28, 2019 5:48PM

    Unfortunately, what I was afraid to happen has already happened. I use a function to set page item's value when "delete row" menu item is clicked. Sometimes the code is not working and the page item is not set. Why? I do not know and I can not know when this happens. But it happened more than one time. Maybe it's related to the "row selector". Unfortunately, I can not reproduce the problem. I'd appreciate any help.

    I have the same code in "on-delete" and "on-revert" dynamic actions. each with it's related jQuery selectors.


    jQuery Selector= #PI_DTL_ig_row_actions_menu_5i,#PI_DTL_ig_selection_actions_menu_4i

    (one for the menu item besides the row and the other for menu besides the IG's columns' titles.


    $s("P102_NET_AMOUNT",(itemTotal() - calcDiscount()).toString());


    function itemTotal(){var pi_dtl_model = getGrid("PI_DTL").model;var vSumTotal = 0;pi_dtl_model.forEach( function( record, index, id ) {        var v_total = Number(pi_dtl_model.getValue( record, "TOTAL" )), meta = pi_dtl_model.getRecordMetadata( id );    if (!meta.deleted) {vSumTotal = vSumTotal + v_total; }  });return vSumTotal; }

    calcDiscount(),function calcDiscount(){var vDiscountVal = 0;var vDiscountType = apex.item("P102_DISCOUNT_TYPE").getValue();var vDiscount      = Number(apex.item("P102_DISCOUNT").getValue());if (vDiscountType == "0") {vDiscountVal =  ((itemTotal() * vDiscount)/100)}else  if (vDiscountType =="1") {vDiscountVal = vDiscount;}   return vDiscountVal;}

    - on-revert-changes DA,

    jquery selectors= #PI_DTL_ig_row_actions_menu_8i,#PI_DTL_ig_selection_actions_menu_7i- code, same. 
  • Fernando Lima
    Fernando Lima Member Posts: 125 Red Ribbon
    edited Oct 3, 2019 4:19PM

    In this case, maybe I'll use a IG suscription, using this method you could get the "delete", "refresh", and  "revert" methods, once captured the method you can add your extra code.

Sign In or Register to comment.