I need to hide Duplicate row option under row actions of an interactive grid only for the rows which are disabled.
I am using ‘Allowed Row Operations Column’ option in interactive grid to make some of the rows disabled. But the problem is the user can access row actions for the disabled rows and duplicate those rows. We need to remove the row actions menu for the disabled rows or atleast hide the duplicate row option under it.
What we have tried so far.
1.Tried putting following javascript on page load but it hides the duplicate row option for all rows.
var actions =apex.region("emp").widget().interactiveGrid("getActions");
var v_editable=model.getFieldKey("IS_EDITABLE");
model.forEach(function(e){
if (e[v_editable]!=='U'){
actions.remove("row-duplicate");
}
})
2.Tried to put a dynamic action on click of the row action to hide it if the row is disabled. The interactive grids static Id is emp. This method triggers the DA but the disabling happens with 1 click lag. When I click on the disabled row the DA fires but the duplicate row option is enabled on the next click on any other row we will see the duplicate row option disabled whether its disabled or enabled row.
Event: Click
Selection Type: jQuery Selector
jQuery Selector: #emp .a-Button–actions
Action: Execute Javascript
Code:
var view = apex.region("emp").widget().interactiveGrid("getViews", "grid");
var record = view.model.getRecord(value);
var name = view.model.getValue(record,"IS_EDITABLE" );
var ga = apex.region("emp").widget().interactiveGrid("getActions");
console.log(name);
if (name !== 'U'){
ga.disable("row-duplicate");
}else{
ga.enable("row-duplicate");
}
Is there any inputs to what may be going wrong