Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

I'm using a pageBlock component, it's obviously very handy for storing my returned object/s but I really don't like how it looks. As I'm quite new to apex/salesforce, I'm wondering is there a way to overwrite the styles attached to the pageBlock?

Is there a convention for it? Or can I even use a regular html table in it's place?

        <apex:pageBlock >

        <apex:pageBlockSection columns="1">

           <apex:pageBlockTable value="{!attachments}" var="attach" id="attachmentsTable">

               <apex:column >
                   <apex:outputText value="{!attach.name}"/>
               </apex:column>                  

               <apex:column >
                   <apex:outputText value="{!attach.description}"/>
               </apex:column> 

               <apex:column >
                   <apex:outputLink styleClass="actionLink" target="_BLANK" value="/servlet/servlet.FileDownload?file={!attach.Id}">View</apex:outputLink>
               </apex:column> 

           </apex:pageBlockTable> 

         </apex:pageBlockSection>

    </apex:pageBlock>
share|improve this question
1  
Keep in mind that salesforce does not guarantee the output html or their css to be the same in new releases. –  Samuel De Rycke Apr 16 at 9:37

1 Answer 1

up vote 5 down vote accepted

Yes, you can overwrite it with your own CSS, just don't forget to insert !important. Or you can assign your own css class to the components using styleClass="myCssClass" parameter.

Of course you can create your own pure HTML table and iterate through attachments list using apex:repeat tag:

<table>
    <apex:repeat value="{!attachments}" var="attach">
        <tr>
            <td><apex:outputText value="{!attach.name}"/></td>
            <td><apex:outputText value="{!attach.description}"/></td>
        </tr>
    </apex:repeat>
</table>
share|improve this answer
    
Ah!! Good lad mast0r!! This is exactly what I need! Cheers!! –  Daft Apr 16 at 9:45

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.