I am adding a row inside a row..Here is the scenario. On Click of add button i am adding a row.i know how to do that..I am able to do that.Now i want to add more rows inside that row using some different button i.e i have adding a row by clicking on main add row button.now i also have a different section inside that row where i can further add rows.
<apex:repeat value="{!wrapperList}" var="wra">
<apex:pageBlock title="Consolidated Feed">
<apex:pageBlockSection >
<table>
<tr>
<td>
<apex:inputField value="{!wra.conFeed.CPF_Quantity__c}"/>
</td>
</tr>
</table>
</apex:pageBlockSection>
</apex:pageBlock>
<apex:pageBlock title="test">
<apex:commandButton action="{!addRowHex}" value="Add new section inside" reRender="hexSec" />
<apex:pageBlockSection >
<apex:repeat value="{!wra.excEnti}" var="wrEx">
<apex:inputField value="{!wrEx.Name}"/>
<apex:inputField value="{!wrEx.Hex_Code__c}"/>
</apex:repeat>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:repeat>
wrapper class
public object1 conFeed{get;set;}
public List<object2> excEnti{get;set;}
public Integer counterWrap{get;set;}
public wrapperClass(object1 conFeed,List<object2> excEnti)
{
this.conFeed=conFeed;
this.excEnti=excEnti;
}
}
public void addRow(){
wrapperClass actWrap = new wrapperClass(new object1(),new List<object2>());
counter++;
actWrap.counterWrap = counter;
wrapperList.add(actWrap);
}
**public void addRowHex()
{
**//I dont know what to write here.//Please help.How to add a row inside of the first row added**
}**
Best Answer
The below example should get you started on what you want to achieve. You can try it out separately as it uses the standard Account and Contact objects.
Page:
Controller: