I am working on a project in Kony where I want to hide a button on certain condition.
I have used the code which is given below and it is working on Android but not on iOS. I have also checked using a debugger, everything is fine, Also I am getting the value in debugging mode i.e True/False. But does not hide the button on condition on the iOS device only.
Initially, I am setting the visibility as "True" of Button and calling the Service function in Postshow of the form. So, During Postshow Call, it should check the condition and change the visibility property of the button.
I have used following code (MVC Pattern):
if(condition==true) //some condition
{
this.view.BtnBack.isVisible=False;
}
else
{
this.view.BtnBack.isVisible=True;
}
Note: Above code works on Android, SPA Android but does not work on iOS devices.
Help!
Finally, I found a solution for this and it worked.
Solution is:
I have created 2 skins for that button
1) "SkinHide" -> Background Color opacity is 0%
2) "SkinHide" -> Instead of Background Color I have used Background Image and kept Opacity to 100%.
Also applied "SetEnabled" property to True/False depending on my condition.
Below is the Code Snippet :
if(id=="cat00000")
{
this.view.tmpHeader.btnBack.skin="SkinHide";
this.view.tmpHeader.btnBack.setEnabled(false)
}
else
{
this.view.tmpHeader.btnBack.skin="SkinShow";
this.view.tmpHeader.btnBack.setEnabled(true);
}
Happy Coding !