AWildmann
AWildmann

Reputation: 189

Disabling Items in APEX Interactive Grid - Action Dropdown Menu

The idea here is to remove/disable certain items from the Actions Dropdown Menu from an Interactive Grid.

I've managed to disable the "Aggregate" option so far with the following code:

`function(config) {
    config.initActions = function( actions ) {
        actions.hide("show-aggregate-dialog");
    }
    return config;
}`

Aggregate Option removed

Now I'm trying to do the same with some other options, such as Refresh (shown as Aktualisieren), but the following line, which was added to the previous code, does nothing:

 actions.hide("show-filter-dialog");

I've tried a couple things to attempt and remove the rest, such as the the none !important css function, without results:

#ig_id button[data-action="show-filter-dialog"] {
    display: none !important;
}

I've attempted the Remove action as well, with no success:

actions.remove("show-filter-dialog");

Also with the use of the "Index menu removal" function, I managed to remove the whole Daten option, though I'd prefer only disabling certain items from it, not the whole thing:

var $ = apex.jQuery;
   var toolbarData = $.apex.interactiveGrid.copyDefaultToolbar();
   config.toolbarData = toolbarData;
   toolbarData[3].controls[0].menu.items[3]['hide'] = true;
   return config;

Date option removed

Is there something wrong with the methods I'm using? Are they capable of changing these items? Or I can only change these with plugins?

Also, I sometimes feel confused on where I should be putting some of these codes. Should javascript functions be put only in the Attributes section of the Interactive Grid or in the When Page Loaded section?

Upvotes: 0

Views: 4159

Answers (1)

AWildmann
AWildmann

Reputation: 189

So, after a bit of experimenting and messing around with the code, I managed to solve everything here. I'm posting the solution in case someone else might want to use it as well. There might be better, easier and likely more unified ways of hiding it, rather than using so many different functions, but I suppose I have to learn more about Javascript first. This is the code and the properties that worked for me:

function(config) {
    config.initActions = function( actions ) {

        actions.hide("show-aggregate-dialog"); // hides Aggregate
        actions.hide("refresh"); // Hides Refresh inside "Data"
        actions.hide("chart-view"); // Hides Chart. Thanks to Alli Pierre Yotti in Apex Forums

        actions.remove("show-columns-dialog"); // Hides Columns
        actions.remove("show-filter-dialog"); // Hides Filter
        actions.remove("show-help-dialog"); // Hides Help
    }

   var $ = apex.jQuery;
   var toolbarData = $.apex.interactiveGrid.copyDefaultToolbar();
   config.toolbarData = toolbarData;
   toolbarData[3].controls[0].menu.items[4]['hide'] = true; // Hides Format
   toolbarData[3].controls[0].menu.items[8]['hide'] = true; // Hides Report

   config.features.flashback = false; // Hides Flashback

   return config;
}

Upvotes: 2

Related Questions