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
DoondiDoondi 

How to display more than 15 fields in list views ??

How to display more than 15 fields in a list view on visualforce?
If i am using <apex:selectlist> or <apex:enhancedlist> I am able to build only 15 but not more than that?

 
Sorna JenefaSorna Jenefa
Hi
 I am able to build 15 more than field using <apex:pageBlockTable>

Visualforce Page:

<apex:page controller="AddShowmoreInPageBlockTableController">
          <apex:sectionHeader title="Home" subtitle="Account"/>
             <apex:form>
                  <apex:pageBlock title="Recent Accounts" >
                          <apex:pageBlockTable value="{!accts}" var="account" id="table">
                                     <apex:column headerValue="Account Name">{!account.Name}</apex:column>
                                     <apex:column headerValue="Billing City">{!account.BillingCity}</apex:column>
                                     <apex:column headerValue="Phone">{!account.Phone}</apex:column>

                                                <apex:column headerValue="Account Name">{!account.Name}</apex:column>
                                     <apex:column headerValue="Billing City">{!account.BillingCity}</apex:column>
                                     <apex:column headerValue="Phone">{!account.Phone}</apex:column>

                                                <apex:column headerValue="Account Name">{!account.Name}</apex:column>
                                     <apex:column headerValue="Billing City">{!account.BillingCity}</apex:column>
                                     <apex:column headerValue="Phone">{!account.Phone}</apex:column>

                                                <apex:column headerValue="Account Name">{!account.Name}</apex:column>
                                     <apex:column headerValue="Billing City">{!account.BillingCity}</apex:column>
                                     <apex:column headerValue="Phone">{!account.Phone}</apex:column>

                                                <apex:column headerValue="Account Name">{!account.Name}</apex:column>
                                     <apex:column headerValue="Billing City">{!account.BillingCity}</apex:column>
                                     <apex:column headerValue="Phone">{!account.Phone}</apex:column>

                                                <apex:column headerValue="Account Name">{!account.Name}</apex:column>
                                     <apex:column headerValue="Billing City">{!account.BillingCity}</apex:column>
                                     <apex:column headerValue="Phone">{!account.Phone}</apex:column>

                                                <apex:column headerValue="Account Name">{!account.Name}</apex:column>
                                     <apex:column headerValue="Billing City">{!account.BillingCity}</apex:column>
                                     <apex:column headerValue="Phone">{!account.Phone}</apex:column>

                          </apex:pageBlockTable><br/>
                       <apex:commandLink value="Show 25 items" action="{!showmoreAccount}" reRender="table"  />
          <apex:commandLink value="Show 10 items" onclick="window.location.reload();" rendered="{!Enable=='edit2'}"/>
           </apex:pageBlock>
        </apex:form>
</apex:page>


Controller coding:

 public class AddShowmoreInPageBlockTableController {
         public String Enable{get;set;}
         public Account account{get;set;}
         public List<Account> accts{get;set;}
  
               public AddShowmoreInPageBlockTableController() {
                      accts = [select Id,Name,BillingCity,Phone from Account limit 10];
      
               }
           public PageReference showmoreAccount() {
                   accts =  [select Id,Name,BillingCity,Phone from Account limit 25]; 
                   Enable='edit2';
                   return null;
             }
    }

I am using three field to populate the data and display in page 
if you need more detail you can change the content
 
User-added image
Thanks,
Jenefa
Sweet Potato Tec
Sorna JenefaSorna Jenefa
Hi

Can you please share ur code for me...

Thanks,
Jenefa 
Sorna JenefaSorna Jenefa
Hi
Now try this one:

<apex:page standardController="Account" recordSetvar="accounts">
  <apex:pageBlock title="Viewing Accounts">
  <apex:form id="theForm">
    <apex:panelGrid columns="2">
      <apex:outputLabel value="View:"/>
      <apex:selectList value="{!filterId}" size="1">
        <apex:actionSupport event="onchange" rerender="list"/>
        <apex:selectOptions value="{!listviewoptions}"/>
      </apex:selectList>
    </apex:panelGrid>
    <apex:pageBlockSection >
      <apex:dataList var="a" value="{!accounts}" id="list">
        {!a.name} </apex:dataList>
    </apex:pageBlockSection>
      
    <apex:dataTable value="{!accounts}" var="a" id="list" cellspacing="5px" cellpadding="5px" >
            
                              <apex:column headerValue="Billing City" >{!a.BillingCity}</apex:column>
                              <apex:column headerValue="Billing City">{!a.BillingCity}</apex:column>
                              <apex:column headerValue="Phone" width="20%">{!a.Phone}</apex:column>
                               <apex:column headerValue="Billing City" >{!a.BillingCity}</apex:column>
                              <apex:column headerValue="Billing City">{!a.BillingCity}</apex:column>
                              <apex:column headerValue="Phone" width="20%">{!a.Phone}</apex:column>
                              <apex:column headerValue="Account Name">{!a.Name}</apex:column>
                              <apex:column headerValue="Billing City">{!a.BillingCity}</apex:column>
                              <apex:column headerValue="Phone" width="20%">{!a.Phone}</apex:column>
                              <apex:column headerValue="Billing City" >{!a.BillingCity}</apex:column>
                              <apex:column headerValue="Billing City">{!a.BillingCity}</apex:column>
                              <apex:column headerValue="Phone" width="20%">{!a.Phone}</apex:column>
                               <apex:column headerValue="Account Name">{!a.Name}</apex:column>
                               <apex:column headerValue="Billing City">{!a.BillingCity}</apex:column>
                              <apex:column headerValue="Phone" width="20%">{!a.Phone}</apex:column>
                               <apex:column headerValue="Account Name" >{!a.Name}</apex:column>
                                <apex:column headerValue="Billing City">{!a.BillingCity}</apex:column>
                                <apex:column headerValue="Phone" width="20%">{!a.Phone}</apex:column>
                                     
                                  
    </apex:dataTable>      
  </apex:form>
  </apex:pageBlock>

If you need the space you adjust the width for the field 

Thanks,
Jenefa
Sweet Potato Tec
     
    
   
DoondiDoondi
When I change the View, the colums are not changing dynamically (I used IF else condition in visualforce page to display colums only when it matches value with views.
Now the real challenging is How to make the UI the same as Standard objects UI

any help or link will be a great.

Thanks inadvance for your time