Page 1 of 1

Hide Button

Posted: Fri Aug 19, 2016 1:01 pm
by Josiel Denardi6690187

I want to hide the button if the return from REST SERVICE will be empty.

If the "whatsapp" from REST SERVICE will be empty, the app should hide the button with the name "whatsapp"

Thank you.

Image Image


Hide Button

Posted: Fri Aug 19, 2016 2:39 pm
by Terry Gilliver

Try this:
click on js next to the whatlabel text field and add the following javascript:

pre
if (value === undefined) {
Apperyio("whatsapp").hide();
} else {
Apperyio("whatsapp").show();
}
return value;
/pre

Hopefully this will hide the whatsapp button if the corresponding data is empty


Hide Button

Posted: Fri Aug 19, 2016 5:05 pm
by Josiel Denardi6690187

Run when I was put if (value === undefined || value === "").

Thanks a lot,


Hide Button

Posted: Fri Aug 19, 2016 5:38 pm
by Josiel Denardi6690187

Terry, have a detail, the button is into list (list item) component. the system only considers the first button for hide. How I do for apply the hide for other buttons from list component? Is a array the buttons?


Hide Button

Posted: Mon Aug 22, 2016 10:26 am
by Terry Gilliver

Glad i could help


Hide Button

Posted: Fri Nov 04, 2016 12:01 pm
by Deon

Hi

Does not work for me. This only applies to the first value in the list. For some reason it is not repeated for all list items?

Can anyone help, pleas?
Thanks


Hide Button

Posted: Tue Nov 08, 2016 12:08 pm
by Terry Gilliver

It should work for all list items, try checking the value of 'value' in the js and then altering the code above.

Notice if (value === undefined) worked for me, but Josiel also needed to check for a null string if (value === undefined || value === "").

It might be that you are checking for the wrong value,