Hi all, I have AEM forms Table connected to Schema binding, The rows of table repeats as per the amount of items present in the schema, Is there any event , or technique i can use to trigger a specific script only at the last instance of the table row, and not when every row is getting generated? Any help ideas would be helpful.
thanks.
Views
Replies
Total Likes
I think triggering your script from Table::ready:layout
Views
Replies
Total Likes
Thank you, but i should have mentioned this is Adaptive Form table where these rows are repeating. Thanks Again
Views
Replies
Total Likes
Try triggering from "Table - Visibility" or a parent panel.
Views
Replies
Total Likes
I tried executing from Table - Visibility event. the script does get executed after the instances are created. But seems like Dom is not updated with these new instances.
On Table Visibility: Maybe below script can help explain the problem.
==============
//Event:visibility:
var insCnt = TableA.Row1.instanceManager.instanceCount; //Gives 5 Row 1 repeats 5 times via binding.
for (var i=0 ; i< insCnt ; i++)
{
var rowID = TableA.Row1.instanceManager.instances[i].id; // Works as id of ROw1 instance is available.
$("#"+rowID) // Cant find using Jquery, as Instance is not updated in the DOM ?
}
Can you have any way around this?
Regards,
Views
Replies
Total Likes
I think that should work. Can you console.log that and see what you get?
What are you eventually trying to achieve?
Views
Replies
Total Likes
this.instanceManager.instanceCount - used to determine total number of repeatable instances/rows
this.instanceIndex - used to fetch current row index#(typically starts from 0,1,2..)
if(this.instanceManager.instanceCount === this.instanceIndex+1)
{
//add specific script for the last instance/row
}
Views
Replies
Total Likes