You need to sign in to do that
Don't have an account?
DeveloperSud
Dynamic Add row button in pageBlockTable without Resetting the entered input values in each row while clicking add row button
Hi Guys,
I have created a pageblock table where user can dynmically add and remove rows .In each rows I am using an input field .The problem I am facing while clicking the add row button its resetting the previous value entered in the previous row.Kindly help if anyone else faced the same problem .
I have created a pageblock table where user can dynmically add and remove rows .In each rows I am using an input field .The problem I am facing while clicking the add row button its resetting the previous value entered in the previous row.Kindly help if anyone else faced the same problem .
<apex:page standardController="Account" extensions="AddnRemoveController" > <apex:form id="f" > <apex:pageMessages ></apex:pageMessages> <div> <apex:pageBlock mode="maindetail" > <!-- <apex:variable value="{!0}" var="rowNumber" /> --> <apex:commandButton value="AddRow" action="{!addrow}" reRender="table"> </apex:commandButton> <apex:commandButton value="Remove Row" action="{!removerow}" reRender="table"> <!-- <apex:param value="" name="rowNum" assignTo="{!rowNum}" /> --> </apex:commandButton> <apex:pageBlockTable value="{!wrapList}" var="wrapVar" id="table"> <!-- <apex:variable value="{!wrapVar.index}" var="rowNumber" /> --> <apex:column >{!wrapVar.index}</apex:column> <apex:column headervalue="{!wrapVar.act.Industry}"> <apex:inputField value="{!wrapVar.act.Industry}" id="modalBankCountry"/> </apex:column> </apex:pageBlockTable> <apex:commandButton value="Save" action="{!saving}" /> </apex:pageBlock> </div> </apex:form> </apex:page>
<apex:page standardController="Account" extensions="AddnRemoveController" > <apex:form id="f" > <apex:pageMessages ></apex:pageMessages> <div> <apex:pageBlock mode="maindetail" > <!-- <apex:variable value="{!0}" var="rowNumber" /> --> <apex:commandButton value="AddRow" action="{!addrow}" reRender="table"> </apex:commandButton> <apex:commandButton value="Remove Row" action="{!removerow}" reRender="table"> <!-- <apex:param value="" name="rowNum" assignTo="{!rowNum}" /> --> </apex:commandButton> <apex:pageBlockTable value="{!wrapList}" var="wrapVar" id="table"> <!-- <apex:variable value="{!wrapVar.index}" var="rowNumber" /> --> <apex:column >{!wrapVar.index}</apex:column> <apex:column headervalue="{!wrapVar.act.Industry}"> <apex:inputField value="{!wrapVar.act.Industry}" id="modalBankCountry"/> </apex:column> </apex:pageBlockTable> <apex:commandButton value="Save" action="{!saving}" /> </apex:pageBlock> </div> </apex:form> </apex:page>
Please find this below.