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!

Enable/Disable custom row action menu button based on column value

user10761694Oct 13 2022

I need to do something like the below as mentioned by another user in 2018. The user has also given the solution of what to do. But I need to know where to put the solution code. P
Please some one let me know where should I put the suggestion solution code, which is explained in detail after the question below.
"After creating the custom rowActionMenu buttons, I added code to pass in a {beforeOpen: function() {}} to the menu object. " - Where do I put this?
Thank you
Question:
I want to enable/disable a custom Approve button. I only want the Approve button to be enabled for rows that require approval. Clicking the actions menu does not select the record. I need to know what event I can use to perform the check so that the button is only enabled if it is applicable for the specific row it is being called on.
image.pngSuggested Solution by other user:
After creating the custom rowActionMenu buttons, I added code to pass in a {beforeOpen: function() {}} to the menu object.
rowActionMenuObj$.menu({beforeOpen: function(event, ui) {
var lRow$ = view.view$.find('.is-active').closest('tr');
var record = view.getContextRecord(lRow$)[0];
var recordId = view.model.getValue(record, "EXPENSES_ID");
var recordStatusCode = view.model.getValue(record, "RECORD_STATUS_CODE");
if (isApprover && (recordStatusCode == 'N' || recordStatusCode == 'C')) {
var approveExpensesItem = rowActionMenuObj$.menu("find", "approve-expense");
approveExpensesItem.disabled = false;
} else {
var approveExpensesItem = rowActionMenuObj$.menu("find", "approve-expense");
approveExpensesItem.disabled = true;
}
}});

Comments
Post Details
Added on Oct 13 2022
0 comments
350 views