Why adding a custom control manual if you already have a repeat control wich can create any number of of ccPersondata. Instead of adding a control manual by using component injection i would just add another empty value to your repeated Array (like a empty Person object/Array whatever you are using to hold the person's data) and refresh the repeat control.
Here a small example what i mean:
<xp:repeat id="repeat1" rows="30" var="rowData" indexVar="rowIndex">
<xp:this.value><![CDATA[#{javascript://
var person = function(name,age){
this.name = name;
this.age = age;
}
if(!viewScope.containsKey('list')){
viewScope.list = [];
list.push(new person("victor","24"));
list.push(new person("Igor","24"));
}
return viewScope.list;}]]></xp:this.value>
<xp:panel>
<xp:text
escape="true"
id="computedField1"
value="#{rowData.name}">
</xp:text>
<br></br>
<!-- here is your ccPersonData -->
</xp:panel>
</xp:repeat>
<xp:button value="addPerson" id="button1">
<xp:eventHandler
event="onclick" submit="true" refreshMode="partial" refreshId="repeat1">
<xp:this.action><![CDATA[#{javascript:
var person = function(name,age){
this.name = name;
this.age = age;
}
var emptyPerson = new person('none','0');
viewScope.list.push(emptyPerson);}]]></xp:this.action>
</xp:eventHandler>
</xp:button>
In your case instead of the SSJS Objects i would use a java class or documents depending on your needs. Also i would use a java class wich handles the data for the repeat so you can handle the functions (new persons, or save Person) with this class.. maby including a method addPersonOnPsoition()....