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!

Interactive Grid : how to hide Add Row button conditionally

SmithJohn45Jul 11 2024 — edited Jul 11 2024

Apex 23.1

had a Master-Detail page where Master contains a column Posted (P178_POST) if its value is ‘Y’ then in Detail (IG) it should hide ‘Add Row’ button otherwise show it, additionally they used F7 key to ‘ add row ’, also this should not work in this condition.

here is code in 'Function and Global Variable Declaration' to map F7 key with action:

// ############################# START HOT-KEYS ############################# //
/* To get code of key please..
visit: 	http://keycode.info/    
OR 		http://www.cambiaresearch.com/articles/15/javascript-key-codes
License: Free
Resource: www.geekinto.com , [Facebook Group: How to Oracle APEX]
By: Amr Abdeen [Egypt] 28-11-2016
*/

var map = {118: false};
$(document).keydown(function(e) {
   if (e.keyCode in map) {
       map[e.keyCode] = true;
        
        // Add a new row
       if (map[118]) {
            
            /*NOW FIRE YOUR COMMANDS ..*/
            //javascript:apex.widget.tabular.addRow();
           apex.region("item").widget().interactiveGrid("getActions").invoke('selection-add-row');  
       }
   }
    
}).keyup(function(e) {
   if (e.keyCode in map) {
       map[e.keyCode] = false;
   }
});

// ############################# END HOT-KEYS ############################# //

regards

This post has been answered by John Snyders-Oracle on Jul 11 2024
Jump to Answer
Comments
Post Details
Added on Jul 11 2024
5 comments
723 views