You need to sign in to do that
Don't have an account?

how to display values in specific command button in pageblocktable
i added command button for every coloum in apex:repeat, if i click on that button then it is invoking wrapper class and displaying the wrapper class rows to all columns in apex:repeat .... i want to only display the wrapper class data for the specific row only. please help me.

Visualforce page:-
Apex:controller:-
Visualforce page:-
<apex:page controller="createDynamicTableProcess" > <apex:form > <apex:pageblock title="All contacts" > <apex:repeat value="{!cons}" var="a" > <table border="1" width="300px;" > <tr> <td><apex:outputtext value="{!a.name}" /> <br/></td> <td><apex:outputtext value="{!a.phone}" /><br/></td> <td><apex:outputtext value="{!a.account.industry}" /><br/></td> <td><apex:commandbutton value="Add Row" action="{!createRecordForSubContact}" > <apex:param name="sending contact id" value="{!a.id}" assignto="{!contactid}" /> </apex:commandbutton> <br/><br/></td> </tr> </table> <apex:pageblocktable value="{!scw}" var="a" id="pbt1"> <apex:column ><apex:inputcheckbox value="{!a.flag}" /> </apex:column> <apex:column ><apex:inputtext value="{!a.name}" onchange="getrec(this.id)" id="v1"/> </apex:column> <apex:column ><apex:inputtext value="{!a.country}" onchange="getrec(this.id)" id="v2"/> </apex:column> </apex:pageblocktable> </apex:repeat> </apex:pageblock> </apex:form> </apex:page>
Apex:controller:-
public class createDynamicTableProcess { public list<contact> cons{set;get;} public string contactid {set;get;} public list<subcontactwrapper> scw{set;get;} public createDynamicTableProcess () { cons=new list<contact>(); list<string> accids=new list<string>(); for(account a1:[select id from account]) { accids.add(a1.id); } cons=[select id,name,phone,account.industry from contact where accountid in:accids limit 10]; } //constructor closed //method for button click for every contact. public void createRecordForSubContact() { scw=new list<subcontactwrapper>(); subcontactwrapper s1=new subcontactwrapper(); scw.add(s1); } public class subcontactwrapper { public boolean flag {set;get;} public string name {set;get;} public string country {Set;get;} public date startdate {Set;get;} } }