I am working on a functionality that hides a button and uses a wrapper for assigning a value (ex. wrapperClass.showButton = false). I checked the Apex debug and it is setting the wrapperClass.showButton to false. I also checked on the JS controller and it gets the value being returned from Apex which is "false". I have a condition on CMP that shows the button if attribute !v.wrapperClass.showButton is true. Even the value being set on JS is false, the button still shows. I checked for spelling errors too but there is none.
//For the reference, here is the JS:
({
doInit : function(component, event, helper) {
debugger
let request = {
objId: component.get("v.recordId")
}
customUtils.callServerAction(component, "c.showButton", request).then((res)=>{
component.set("v.wrapperClass", res.getReturnValue());
console.log('showButton::' + wrapperClass.showButton:'); //value is false
})
}
})
'
at the end would be a syntax error, preventing deployment, and (2)wrapperClass
isn't shown anywhere else in the code. As such, we don't really know what's wrong with your code. We'd need more information to properly help you.