0

MyDetail is a class of which MyContacts is a wrapper where value is binded for UI. MyDetail.Mycontacts has all its values as null in it. Here's with an example. My values-->{!MyDetail.Mycontacts} in visualforce gives me as:

 My values-->[someValue:[value1=null, value2=null, value3=null, value4=null]]

I want to render a table below if all the value are null then the table shouldn't show on VF. I have tried as following but doesn't seem to work.

<apex:pageblocktable value="{!MyDetail.Mycontacts}" border="1" rendered="{!MyDetail.Mycontacts}">    

Any suggestion would be helpful. Thanks in advance!

  • you didn't handle the null condition of every attributes for rendering then how come it is expected to work? – Santanu Boral Jun 16 '17 at 14:42
  • As I said MyDetail.Mycontacts values are null. Shouldn't rendered attribute be working if values are null? That's my expectation. – MnZ Jun 16 '17 at 14:57
  • rendered expression needs to resolve to boolean. Have you tried rendered="{!MyDetail.Mycontacts} <> null"? – Daniel Hoechst Jun 16 '17 at 15:24
  • Hi @DanielHoechst I added your suggestion, it does hide the table, but it also hide for those which has values too. So I tried rendered="{!MyDetail.Mycontacts}!=null". Didn't work. Let me know if I can refer any doc – MnZ Jun 16 '17 at 15:50
  • Hi @DanielHoechst. Thanks. I added your suggestion, it does hide the table, but it also hide for those which has values too. So I tried rendered="{!MyDetail.Mycontacts}!=null". Didn't work. Let me know if I can refer any doc – MnZ Jun 16 '17 at 15:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.