I am 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 doesn't get added. Can anyone tell me what is wrong with my code.