You need to sign in to do that
Don't have an account?
Mubarak
Unable to add row dynamically in vf page
Hi
Iam beginner to salesforce.I want to add row dynamically to vf page when i clicked add row button.
this is my script...........
<apex:page standardController="Employee__c" extensions="Cutomextension">
<apex:form >
<apex:pageBlock >
<apex:pageBlockTable value="{!Employee__c}" var="emp">
<apex:column headerValue=" Employee Name">
<apex:inputField value="{!emp.name}"/>
</apex:column>
</apex:pageBlockTable>
<apex:commandButton action="{!add}" value="Add Row"/>
</apex:pageBlock>
</apex:form>
</apex:page>
=====Controller=====
public with sharing class Cutomextension {
public Employee__c emp {get; set;}
public List<Employee__c> empList {get; set;}
public static Integer addCount {get; set;}
public Cutomextension(ApexPages.StandardController controller) {
this.emp = (Employee__c)Controller.getRecord();
empList = new List<employee__c>();
}
public void add() {
empList.add(new employee__c());
}}
When i clicked add row button ,new row doesnt get added.Can anyone tell me what is wrong with my code.
Iam beginner to salesforce.I want to add row dynamically to vf page when i clicked add row button.
this is my script...........
<apex:page standardController="Employee__c" extensions="Cutomextension">
<apex:form >
<apex:pageBlock >
<apex:pageBlockTable value="{!Employee__c}" var="emp">
<apex:column headerValue=" Employee Name">
<apex:inputField value="{!emp.name}"/>
</apex:column>
</apex:pageBlockTable>
<apex:commandButton action="{!add}" value="Add Row"/>
</apex:pageBlock>
</apex:form>
</apex:page>
=====Controller=====
public with sharing class Cutomextension {
public Employee__c emp {get; set;}
public List<Employee__c> empList {get; set;}
public static Integer addCount {get; set;}
public Cutomextension(ApexPages.StandardController controller) {
this.emp = (Employee__c)Controller.getRecord();
empList = new List<employee__c>();
}
public void add() {
empList.add(new employee__c());
}}
When i clicked add row button ,new row doesnt get added.Can anyone tell me what is wrong with my code.
I think you should add a rerender to the add button on the visualforce page, it can rerender the table when you add an employee, so that it shows the newest list.
Can you see the code in the below link:
https://developer.salesforce.com/forums/ForumsMain?id=906F0000000AiyEIAS
Best Regards
Naga kiran
Even I used rerender its not working.Is it need to use Wrapper class here?