I have a data model containing a detail table. I know the table will contain up to 32 lines.
In Designer I can display this table within my template and it looks fine.
How can I control the start and end points of the display? For example, how can start with line 1 and go to line 15, or start with line 16 and go to the end. It seems such a basic requirement, but I can’t find any controls for this at all.
If I understand you correctly, you ask how to display detail lines other than sequentially?
That would need to be done via a script. You would need to populate your detail table manually.
I suggest adding a dynamic table (HTML detail table) on your Template, go to HTML Preview (even if it looks bad because it is not made for Print Section) and look at the inspector code (F12).
On the table->tbody section of the code, you will see how each detail line is managed. Then with proper script based on data-breakable property, you will be able to fill in the proper placeholder with the detail lines of your choice. You will notice that there is a data-breakable for each detail line of your detail table. even if overflow occurs, the data-breakable property keeps the same continuous increment for numbering.
Hope that help.
Thank you for your help. Using the script from this post fixed rows within a Details Table - General - Upland OL User community as a guide, I came up with this script that seems to do the trick.
> results.each(function(i){
> if(i<15){
> let subItems ="";
> subItems += '<tr data-repeat="" data-breakable="' + i+ '"><td>';
> subItems += record.tables.detail[i].fields.Quantity+ '</td><td>';
> if (record.tables.detail[i].fields.TitleIssue=="")
> subItems += "-</td><td>";
> else
> subItems += record.tables.detail[i].fields.TitleIssue+'</td><td>';
> subItems += record.tables.detail[i].fields.BundleSize+ '</td><td>';
> subItems += record.tables.detail[i].fields.TotalSupply+ '</td><td>';
> subItems += record.tables.detail[i].fields.Bundles+ '</td></tr>';
> this.after(subItems);
> }
> });
Am I right in thinking that it is more efficient to access the data items directly (for example record.tables.detail[i].fields.TotalSupply) rather than use a placeholder (@T3@) and another script to replace them?
Also, having populated the table manually, it now looks like I have to format the data manually as well. Is that right? Just trying to avoid unnecessary scripting!
I was more thinking of a script like this:
results.each(function(index) {
var field;
if(index < 16){ //******First 16 instances of my placeholder******
field = record.tables["detail"][(index+16)].fields["Description"];
this.html(field);
}else{
this.parent().hide();//******Hide any other TR that are above 16
}
});
In this script, I only show the first 16 TR and populate them with the last 16 detail lines values. Remember that “index” is 0 based.