Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 10548

Hide Button if Field Empty

$
0
0

I have a view which I create a new button. I'm using a JSONModel to bind data to the button like so:

 

var btnCall = new sap.m.Button('btnCall' { text: "{PHONE}",     press: [oController.onCall, oController]});

Not all records have a phone number, in that case I want to hide the button (setVisible(false)). Can you folks provide or point me to an example that does this? In the view, I tried to read the button text with getText(), but it's empty, I think because the data is binded after the view renders. This seems so simple, but I'm missing something.

 

I should have prefaced, I'm new to MVC and OOP. Any help would be greatly appreciated.


Viewing all articles
Browse latest Browse all 10548

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>