0

I have a custom object - Obj__c. In a vf page when I return those object records under a pageblock section with column="2" in order by sequence field value, they showup as 1st , 3rd , 5th record under column 1. 2nd , 4th , 6th record under column 2.

I need to show them as 1st , 2nd , 3rd under column 1 and 4th , 5th , 6th under column 2.

Please let me know how can I achieve that?

Page code:

 <apex:repeat value="{!FieldSObjs}" var="s"> //FieldSObjs this is the metadata //object records referred to.
                 <apex:pageBlockSectionItem rendered="{!s.dispUpdate == 'Update Only' || s.dispUpdate == 'Display and Update'}">
                     <apex:outputText >{!s.Label}</apex:outputText>
                     <apex:panelGroup >
                         <apex:inputCheckbox value="{!s.updFlag}" onchange="updUpdateSec();void(0);"/>
                         <apex:inputText disabled="{!!s.updFlag}" value="{!s.newvalue}" maxlength="{!s.len}" rendered="{!s.type == 'STRING' || s.type == 'TEXTAREA'}"/>
                         <apex:input disabled="{!!s.updFlag}" type="number" value="{!s.newNumValue}" rendered="{!s.type == 'INTEGER' || s.type == 'CURRENCY' || s.type == 'DECIMAL' || s.type == 'PERCENT' || s.type == 'DOUBLE'}"/>
                         <apex:input disabled="{!!s.updFlag}" type="date" value="{!s.newValueDate}" rendered="{!s.type == 'DATE'}"/>
                         <apex:input disabled="{!!s.updFlag}" type="datetime-local" value="{!s.newValueDateTime}" rendered="{!s.type == 'DATETIME'}"/>
                         <apex:input disabled="{!!s.updFlag}" type="time" value="{!s.newValueTime}" rendered="{!s.type == 'TIME'}"/>    
                         <apex:inputCheckbox disabled="{!!s.updFlag}" value="{!s.newvalueBoolean}" rendered="{!s.type == 'BOOLEAN'}"/> 
                         <apex:selectList disabled="{!!s.updFlag}" rendered="{!s.type == 'PICKLIST' && s.depPicklist = false}" size="1" value="{!s.newvalue}" >
                            <apex:selectOptions value="{!s.plist}"/>
                            <apex:actionSupport action="{!s.invokeDepPicklistRefresh}" event="onchange" reRender="pb3">
                            </apex:actionSupport>
                         </apex:selectList>   
                         <apex:selectList disabled="{!!s.updFlag}" rendered="{!s.type == 'PICKLIST' && s.depPicklist = true}" size="1" value="{!s.newvalue}" >
                            <apex:selectOptions rendered="{!s.depPicklist = true}" value="{!s.depList}"/>
                         </apex:selectList>
                         <!--apex:commandButton action="{!s.getDepValues}" rendered="{!s.depPicklist = true}" value="Refresh"/-->
                     </apex:panelGroup>
                 </apex:pageBlockSectionItem>
             </apex:repeat>  

Class Code:

 oConfigRecordFieldList = [SELECT  Id , Default_Value_abv__c , Display_Update_abv__c , Field_API_abv__c , MUP_Config_abv__c , Name , Search_Flag_abv__c  
                                    FROM Mass_Update_Process_Field_abv__c where MUP_Config_abv__c  = :ConfigRecordId order by order_abv__c];

                objDesc =  gd.get(oConfigRecord.Object_API_Name_abv__c).getDescribe();  
                objFieldMap = objDesc.fields.getMap();   
                objChilds = objDesc.getChildRelationships();         

                FieldSObjs = new List<cField>();
               // displayFieldSObjs = new List<cField>();
               FieldSObjsMap = new Map<String,cField>();
               depFieldMap = new Map<String,List<String>>();

                for(Mass_Update_Process_Field_abv__c f: oConfigRecordFieldList)
                {
                    sRecordTypeSObjType = '';
                    if(objFieldMap.get(f.Field_API_abv__c) != null)
                    {                   
                        cField cf = new cField(objFieldMap.get(f.Field_API_abv__c).getDescribe(),f.Name, f.Field_API_abv__c,f.Search_Flag_abv__c, f.Display_Update_abv__c,f.Id,this);
                        FieldSObjs.add(cf);
                        FieldSObjsMap.put(cf.apiname, cf);
                    }
1
  • Please add the VF code from your page & the Apex code from your controller / extension to your post, otherwise all we will be able to do is guess. Jun 24, 2015 at 9:53

1 Answer 1

2

okie!!!

so for this you need to take 3 <apex:pageBlockSection> and than for first <apex:pageBlockSection> you need to give columns="2" and for rest 2 <apex:pageBlockSection> you need to give columns="1" and than in second <apex:pageBlockSection> include 1st , 2nd , 3rd fields and in third <apex:pageBlockSection> include 4th , 5th , 6th .. see example below :

<apex:page standardController="contact">
    <apex:form >
        <apex:pageBlock >
        <apex:pageBlockSection columns="2" showHeader="true" title="Test">
         <apex:pageBlockSection columns="1">
                <apex:inputField value="{!contact.FirstName}"  /> <!-- 1st -->
                <apex:inputField value="{!contact.LastName}"  /><!-- 2nd -->
                <apex:inputField value="{!contact.Email}"  /><!-- 3rd -->

        </apex:pageBlockSection>      
        <apex:pageBlockSection columns="1">
                <apex:inputField value="{!contact.Title}"  /> <!-- 4th -->
                <apex:inputField value="{!contact.Birthdate}"  /><!-- 5th  -->
                <apex:inputField value="{!contact.Phone }"  /><!-- 6th -->

        </apex:pageBlockSection>      
        </apex:pageBlockSection>      
        </apex:pageBlock >
    </apex:form>
</apex:page>
4
  • This works great. Nice workaround. Jun 24, 2015 at 10:08
  • But I am not having these data directly. I have a metadata object to fetch data from there. I can't directly hardcode Field Names in my case. Jun 24, 2015 at 10:09
  • okie !!! so if this is prob can u please post your code !! so that we can help you out Jun 24, 2015 at 10:14
  • I have added codes to my question. Please have a look Jun 24, 2015 at 10:33

Your Answer

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

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