function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
newbiewvfdevnewbiewvfdev 

<apex:pageBlockTable problem

Hi there,

 

I am trying out the example on developers guide 'Building a Table of Data in a Page'(pg. 29)

 

<apex:page standardController="Account"> <apex:pageBlock title="Hello {!$User.FirstName}!"> You are viewing the {!account.name} account. </apex:pageBlock> <apex:pageBlock title="Contacts"> <apex:pageBlockTable value="{!account.Contacts}" var="contact"> <apex:column value="{!contact.Name}"/> <apex:column value="{!contact.Phone}"/> <apex:column value="{!contact.MailingCity}"/> </apex:pageBlockTable> </apex:pageBlock> </apex:page>

 

 

I created an Account and I created two contacts for the Account.  One of the contact doesn't have MailingCity, so it's empty. The line below the first record stops after the Phone column. Is there a way to fix this?

stephanstephan
Could you reply with a screenshot?
newbiewvfdevnewbiewvfdev

Please click on the link to see the screen shot

 

http://www.ourtimetogether.ca/publicshare/sfimg/image_view_fullscreen

stephanstephan

OK, I see. This looks like a minor CSS/HTML bug. One thing to note is that the new UI skin in the Spring '10 release may well implicitely fix the problem. Could you hang tight until then (March 6th). If it's still an issue after that, let me know and I'll file a bug to have this addressed.

 

...stephan

newbiewvfdevnewbiewvfdev

Hi Stephen,

 

Thanks for your response. I was thinking about checking if the field is null and if it's null put a space otherwise show the actual value. But not sure how to do checks for null value.

 

I want to do something like this, let me know if this is possible and how.

 

<apex:column value="{IF ISNULL(!(contact.MailingCity)) "" ELSE !contact.MailingCity}"/>

 

stephanstephan
I'm not sure if this is going to work, given how merge fields work with apex:column. Again -- hang tight for a week. I suspect the issue may resolve itself with the new skin.
newbiewvfdevnewbiewvfdev

Hi there,

 

Thank you for your reply. I could wait until March 6th.  But I am just wondering why I can't add an empty space. If I do the following for outputField tag it works

 

<apex:outputField value="{!account.description}">&nbsp;</apex:outputField>

 

If the description is empty it puts a space.

 

But if I try something similar for pageBlockTable's column tag, it doesn't work.

 

<apex:column value="{!member.Contact.MailingCity}&nbsp;" /> or <apex:column value="{!member.Contact.MailingCity}">&nbsp;</apex:column>

 

If I do what I did for the column, it doesn't even render any record at all and it doesn't complain when I save either.  I could wait for March 6th, but I am just wondering if this is a bug as well. Thanks.

 

 

stephanstephan

The examples you gave won't work due to how the underlying data binding works. This should do the trick:

 

 

<apex:column headerValue="{!$ObjectType.contact.fields.mailingCity.label}"> <apex:outputField value="{!contact.mailingCity}"/>&nbsp; </apex:column>