We would like to have the index of aggregated element in the template generation. There are a lot of reasons someone needs the index of the aggregation item.
- Display the sequence of the item
- Display a control when it is the first, last, even or odd template
- Pass it as a parameter to an event
- Name an object according to the index
As an example we would like to use the index of aggregation in the name of a TextField
_addressEditFormElementTemplate: function(oController) {
return new sap.ui.commons.form.FormElement(this.createId('fldAddress'), {
label: new sap.ui.commons.Label(this.createId('lblAddress'), {
text: 'Address'
}
}),
fields: [
new sap.ui.commons.TextField(this.createId('inpAddress'), {
value: '{address}',
name: 'addresses[${index}].address'
})
]
});
}
Is it possible now?