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
PrakkiPrakki 

How to pass a dynamic table data to another visualforce page

Dear All,

 

I am requesting for a help to solve this problem.

 

In my visualforce page ( name : Reimbursement) i am having table which containg 4 columns in which user can enter a data. And along with this i am having a command link by name add row, if we click on the Add row link an another row will add to the row. Here there is no limit on number of rows for the table.

 

i having  a command button by the name proceed below the table, if we click on the button the entered details should appear  in the same format  in the other vf page( reimbusementreciever).

 

Kindly help me to solve this please.

 

For reference please find the below code:

 

--VF Page: Reimbursement---
 
 
<apex:page standardcontroller="Reimbursement__c" extensions="Reimbursementformcontroller">
 
<apex:sectionHeader title="Reimbursement Form"/>
<apex:form >
<apex:pageBlock title="Employee Details">
<apex:pageBlockSection columns="1">
<apex:pageBlockSectionItem >
<apex:outputLabel >Name Of The Employee:</apex:outputLabel>
<apex:outputText > {!$User.FirstName}</apex:outputText>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
<apex:pageBlockSection >
<apex:pageBlockTable value="{!reimburselist}" var="rlist">
<apex:column headerValue="Type">
<apex:inputField value="{!rlist.Type__c}"/>
</apex:column>
<apex:column headerValue="Date">
<apex:inputField value="{!rlist.Date__c}"/>
</apex:column>
<apex:column headerValue="Amount">
<apex:inputField value="{!rlist.Amount__c}"/>
</apex:column>
<apex:column headerValue="Approve Amount">
<apex:inputField value="{!rlist.Approved_Amount__c}"/>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlockSection>
<apex:commandLink value="Add" action="{!add}"/>
<br/>
<apex:commandButton value="Proceed" action="{!proceed}"/>
</apex:pageBlock>
</apex:form>
 
</apex:page>
 
-- Controller Code--
 
public with sharing class Reimbursementformcontroller {

public list<Reimbursement__c> reimburselist{get;set;}
public list<reimbursewrapper> reimbursewrapper {get;set;}
public Reimbursementformcontroller(ApexPages.StandardController controller) {
reimburselist = new list<Reimbursement__c>();
reimburselist.add(new Reimbursement__c());
}
public Reimbursementformcontroller() {
reimburselist = new list<Reimbursement__c>();
reimburselist.add(new Reimbursement__c());
}
public void Add()
{
reimburselist.add(new Reimbursement__c());
}
public list<Reimbursement__c> getdisplay(){
list<Reimbursement__c> display = new List<Reimbursement__c>();
for(reimbursewrapper reim : reimbursewrapper)
{
display.add(reim.rr);
}
return display;
}
public PageReference proceed()
{

PageReference np = new PageReference('/apex/Reimbursementformreciever');
np.setRedirect(false);
return np;
}
public class reimbursewrapper{
public Reimbursement__c rr{get;set;}
public reimbursewrapper(reimbursement__c rei)
{
this.rr = rei;
}
}
}
 
--VF Page: ReimbusementReciever--
 
 
<apex:page controller="Reimbursementformcontroller" >
<apex:sectionHeader title="Working With Apex Data Tables (Confirmation)"/>
<apex:form >
<apex:outputText value="You have selected the following contacts for processing, are you sure?"/>
<apex:pageblock >
<apex:PageBlockTable value="{!reimburselist}" var="con" id="selectedContactsTable">
<apex:column value="{!con.Type__c}" headervalue="Full Name"/>
<apex:column value="{!con.Date__c}" headervalue="Title"/>
<apex:column value="{!con.Amount__c}" headervalue="Title"/>
<apex:column value="{!con.Approved_Amount__c}" headervalue="Title"/>
</apex:PageblockTable>
</apex:pageblock>
</apex:form>
</apex:page>

 

 

Thank you.

 

Prakash

 

 

 

 

 

Dhaval PanchalDhaval Panchal
Try to use Visualforce Component.
Create table in component and use that component in both page.
PrakkiPrakki
Hi Dhaval,

Can u please let me know clearly, i mean with piece of code.

Thank you.

Regards,
Prakash