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!

Conditionally change actions in row actions menu on IG

Jeremy WebbJun 4 2020 — edited Jun 24 2020

Hi,

We are using Apex 19.1

In my IG I have added some custom menu items to my row actions menu using the following code in the on page load JavaScript

var view = apex.region("checkIG").widget().interactiveGrid("getViews", "grid"),

menu$ = view.rowActionMenu$;

// Add new menu items

menu$.menu("option").items.push(

    {

        type: "action",

        name: "add-validate",

        label: "Validate",

        icon: "fa fa-check",

        action: function(menu, element) {

            var record = view.getContextRecord( element )[0];

            var rec     = view.model.getValue(record, "RECORD_NUMBER");

            setStatus(rec, 'VALIDATED');

        }

    }

);

menu$.menu("option").items.push(

    {

        type: "action",

        name: "remove-validate",

        label: "Remove validate",

        icon: "fa fa-times",

        action: function(menu, element) {

            var record = view.getContextRecord( element )[0];

            var rec     = view.model.getValue(record, "RECORD_NUMBER");

            unSetStatus(rec, 'REMOVE_VALIDATE');

        }

    }

);

menu$.menu("option").items.push(

    {

        type: "action",

        name: "add-invalidate",

        label: "Invalidate",

        icon: "fa fa-ban",

        action: function(menu, element) {

            var record = view.getContextRecord( element )[0];

            var rec     = view.model.getValue(record, "RECORD_NUMBER");

            setStatus(rec, 'INVALID');

        }

    }

);

menu$.menu("option").items.push(

    {

        type: "action",

        name: "remove-invalidate",

        label: "Remove invalidate",

        icon: "fa fa-times",

        action: function(menu, element) {

            var record = view.getContextRecord( element )[0];

            var rec     = view.model.getValue(record, "RECORD_NUMBER");

            unSetStatus(rec, 'REMOVE_INVALID');

        }

    }

);

This gives me four menu items:

Validate

Remove validate

Invalidate

Remove invalidate

However, I only want to display two of those, or at least have any two enabled, at any one time dependant on the STATUS column in for the row.

So

if STATUS = 'VALIDATED' then I want to show Remove validate and Invalidate

If STATUS = 'INVALIDATED' then I want to show Remove invalidate and Validate

If STATUS IS NULL then I want to show Validate and Invalidate

How can I tell IG to do this?

Any help gratefully received.

Thanks,

Jeremy

This post has been answered by Keyser on Jun 9 2020
Jump to Answer
Comments
Post Details
Added on Jun 4 2020
23 comments
3,115 views