Reputation: 189
How can I change the available options inside the Selection part of a Row Actions Menu in Apex?
I was able to change the options on the Line Menu, but I'm still struggling to change anything on the Selection Menu.
Selection Menu on the left & Line Menu on the right
Upvotes: 3
Views: 10794
Reputation: 11
I got it to omit the "Fill" and "Clear" menu options (plus any others you desire) by combining the solutions of alli pierre yotti and AWildmann, i.e. I did exactly as alli pierre yotti suggests but replaced the disable() method with remove() as referenced by AWildmann.
So here's the code I placed in the "Execute when Page Loads" attribute at the page level. I also replaced the hardwired quoted region name with a variable just to simplify future changes to the region static id, as well as to make it simpler to copy this code to other pages, but this has no effect on the solution.
$(function() {
regionStaticId = "emp"
apex.region(regionStaticId).widget().interactiveGrid("getActions").remove("selection-duplicate");
apex.region(regionStaticId).widget().interactiveGrid("getActions").remove("selection-copy");
apex.region(regionStaticId).widget().interactiveGrid("getActions").remove("selection-fill");
apex.region(regionStaticId).widget().interactiveGrid("getActions").remove("selection-copy-down");
apex.region(regionStaticId).widget().interactiveGrid("getActions").remove("selection-clear");
});
Thanks to the original contributors for the solution, I've only contributed in a superficial way.
I haven't posted on stackoverflow before so apologies if I'm supposed to mark-up the references to the other contributors in a special way.
Upvotes: 1
Reputation: 1
To hide row-level options (in this case, "Delete record"), I use the following CSS:
[id$='ig_row_actions_menu_5'].a-Menu-item,li[id$='ig_row_actions_menu_5'] + .a-Menu-itemSep{ display:none }
Upvotes: 0
Reputation: 189
I found a solution for the editing I wanted. Sharing it here for someone that might want to use it too.
function(config) {
config.initActions = function( actions ) {
// löscht die Option "Single Row-Ansicht"
actions.remove("single-row-view");
actions.remove("selection-duplicate");
actions.remove("selection-refresh");
};
return config;
}
By using the remove action, rather than the widget.disable I was able to remove the fields from the Selection Menu that I meant to change.
Edit: There's a few new options that APEX 18.2 seems to have added. Here are the codes I found so far that disables them. The ones I still haven't figured out how to remove are the "Fill" and "Clear" options. Hope it's useful to anyone trying to get rid of these options.
The code that targets the first two options shown here are:
actions.remove("selection-copy");
actions.remove("selection-duplicate");
I've attempted using the "selection" prefix for the fill and clear options, yet to no avail. If anyone knows their codes, please let me know.
Upvotes: 3
Reputation: 21
I am a newbie too. So decoratively I was able to completely remove the "Row Action " Line options by selecting :- Page Designer -> Content Body-> APEX$Row_Action->GO TO Right Side -> security -> Authorization Scheme -> { Not 'role that has access to the page'Rights}
For the tool bar I used a already discovered hack that I entered in the Java initialization code area under Attributes :
function(config) {
var $ = apex.jQuery;
var toolbarData = $.apex.interactiveGrid.copyDefaultToolbar();
toolbarData.splice(5,3);
//remove actions button
config.autoAddRow = false;
config.toolbarData = toolbarData;
return config
}
Upvotes: 1
Reputation: 175
you can try something like this:
$(function() {
// Add new Element in the selection action menu
$("#emp_ig_selection_actions_menu").menu("option").items.push({
type: "action",
id: "irHello",
hide: false,
label: 'hello world',
icon: 'fa fa-home',
action: function() {
alert("hello world");
}
});
// Disable Items in the Menu
apex.region("emp").widget().interactiveGrid("getActions").disable("selection-duplicate");
apex.region("emp").widget().interactiveGrid("getActions").disable("selection-revert");
});
To understand how the Menu Widget works, have a look here https://docs.oracle.com/database/apex-18.2/AEXJS/menu.html
Demo: https://apex.oracle.com/pls/apex/f?p=28835:2
Upvotes: 2