Skip to main content Starten Sie in die Zukunft mit Agentforce auf der TDX in San Francisco oder bei Salesforce+ vom 5. bis 6. März. Jetzt registrieren.
Hi friends,

I am new to vf page development. My requirement is to bring 5*8 matrix format in page block table.Under Activity column I want bring repeated picklist for 5 rows. And for Sun to Sat columns to bring repeated input field text box for 5 rows. 

Here I have attached my code pls help on this.

My desired output is

User-added image

VF Page

 

<apex:page showHeader="false" sidebar="false" controller="timeentrydetails" >

<apex:form >

<apex:pageBlock title="Time Entry Details Page">

<apex:pageBlockButtons location="top" >

<apex:CommandButton value="Save"/>

<apex:CommandButton value="Submitted"/>

<apex:CommandButton value="Addrows"/>

<apex:CommandButton value="Back"/>

</apex:pageBlockButtons>

</apex:pageBlock>

</apex:form>

<apex:form >

<apex:pageBlock >

<apex:pageBlockTable value="{!Time_entry_dt_list }" var="tm">

<apex:column headerValue="Activity" />

<apex:column headerValue="SUN" />

<apex:column headerValue="MON" />

<apex:column headerValue="TUE" />

<apex:column headerValue="WED" />

<apex:column headerValue="THU" />

<apex:column headerValue="FRI" />

<apex:column headerValue="SAT" />

</apex:pageBlockTable>

</apex:pageBlock>

</apex:form>

</apex:page>

Controller

 

public class timeentrydetails {

Public Class Timeentrydetrow{

Public Id Tmrowid {get;set;}

Public String Activity {get;set;}

Public Integer Hour {get;set;}

}

Public List<Timeentrydetrow> Time_entry_dt_list {get;set;}

Public timeentrydetails(){

Time_entry_dt_list = new List<Timeentrydetrow>();

Timeentrydetrow tmd;

for(Time_Entry_Detail__c tmed : [Select Activity__c,Hour__c from Time_Entry_Detail__c ]){

Timeentrydetrow tr = new Timeentrydetrow();

}

}

}

Regards

Jayabalaji

 
3 Antworten
  1. 17. Aug. 2016, 03:11
    Hi Jayabalaji,

    Please refer below sample code.

     

    <apex:page controller="demo_EXTN">

    <apex:form >

    <apex:pageBlock >

    <apex:variable value="{!0}" var="j"/>

    <apex:pageBlockTable id="row" value="{!matrix}" var="i">

    <apex:column headerValue="Quarter/Year">

    <apex:variable value="{!j+1}" var="j"/>

    <apex:repeat value="{!j}" var="q">

    <apex:outputText >Quarter YR{!q}</apex:outputText>

    </apex:repeat>

    </apex:column>

    <apex:column headerValue="Actual Year 1">

    <apex:inputText />

    </apex:column>

    <apex:column headerValue="Actual Year 2">

    <apex:inputText />

    </apex:column>

    <apex:column headerValue="Actual Year 3">

    <apex:inputText />

    </apex:column>

    <apex:column headerValue="Actual Year 4">

    <apex:inputText />

    </apex:column>

    <!--apex:column >

    <apex:repeat id="columns" value="{!matrix}" var="k" >

    <td>{!k}</td>

    </apex:repeat>

    </apex:column-->

    </apex:pageBlockTable>

    </apex:pageBlock>

    </apex:form>

    </apex:page>

    Controller

     

    public class demo_EXTN{

    public List<List<String>> matrix{get;set;}

    public demo_EXTN()

    {

    matrix = new List<List<String>>();

    List<Contact> contactList = [SELECT id, firstname FROM contact limit 4];

    system.debug(contactList);

    List<Account> accountList = [select id, name FROM Account limit 4];

    system.debug(accountList);

    List<String> row = new List<String>(); // You know that the top left String will be empty

    row.add('Acc/Contact'); // setup list of contact labels at top of grid/matrix

    for(Integer i = 0; i<contactList.size(); i++)

    {

    System.debug(contactList[i].firstname);

    row.add(contactList[i].firstname);

    } // add the first row to the grid

    matrix.add(row);

    System.debug(matrix); // Setup list of account labels in rows of grid

    for(Integer j=0; j<accountList.size(); j++)

    {

    row = new List<String>();

    System.debug(accountList[j].name);

    row.add(accountList[j].name);

    matrix.add(row);

    }

    system.debug(matrix);

    }

    }

    Hope this helps you!

    Please accept my solution as Best Answer if my reply was helpful. It will make it available for other as the proper solution. If you felt I went above and beyond, you can give me kudos.

     

    Thanks and Regards

    Sandhya

     
Ladevorgang läuft
0/9000