How to insert page break forcibly into dynamic table at any position?

I created a dynamic table from nested table. I would like to insert page break forcibly when creating dynamic table but I couldn’t.
I tryed using both “page-break-before: always;” and “data-breakable=""”, but it were not working.

How can I do that?

input

script for creating dynamic table.txt (4.1 KB)

Normally, the page-break-before is to be used on <tr>.

You script should add the page-break-before tag to a <tr> when you condition is true.

@jchamel
I added this but it is not working. Is there wrong?

result += “<tr style="page-break-before:always;">”;

Sorry, I hadn’t looked at your script yet. Now that I did, the problem is that you are completely building the table by script, leaving nothing to the Connect table parser.

Therefore, the page-break-before:always has strictly no effect.

You would need to let the table parser buil the table for you.

Is your table so complex that you can’t use the Wizard?

If that is the case, then you best bet would be to use clone section and then on them use your script. Since you decide when to “page-break”, you would then go to a new clone when “page-breaking”.

@jchamel
I want to display the item title every time the key changes, and I want to control the timing of drawing the border. Therefore, I thought I cannot use the wizard. Was my understanding wrong? If so, could you share how to create the table which I wanted?

Actually, I do not know what is clone. If possible, could you tell me about clone?

If the table was not created by the dynamic table wizard you need to make sure the table element has a data-splitter=2019 attribute. Without that attribute the page-break-before style on table rows is ignored.

I’ll create a ticket, this is a bit obscure and it seems to be undocumented.

Internal reference: SHARED-92191

Sample template that demonstrates the issue: ScriptedTable.OL-template (7.1 KB)

Can you share an anonymized version of your Datamapper and Template so we can play around with it and see what can be done?

If not you can always contact me in PM and you can send it to me by email.

@jchamel
@Sander

The page break worked correctly but I met other issues.
Unfortunately an unnecessary border appears after page break so what should I do?

template_script.txt (5.0 KB)

context_print_styles_css.txt (1.9 KB)

I see what you mean. In my test template things behave correctly after removing the unnecessary border-style: none style from the .no-line rule. Not sure why.

@Sander
@jchamel

Thank you for confirmation. However I could not resolve the issus although I removed the border-style: none style from the .no-line rule.
Would you please try it using my datamapper and template? Thank you for your kind help.

PARTS_INVOICE.OL-datamapper (10.4 KB)

PARTS_INVOICE.OL-template (16.4 KB)

PARTS_INVOICE.pdf (31.9 KB)

Thanks for the files, and apologies for the late reply, I was on holiday.

This is clearly a bug in the embedded browser. I played around with your template but I don’t understand what’s triggering it or how to work around it, sorry. I suggest that you open a support ticket.

I agree with @Sander,

I have been playing around with it and even when forcing border-color: transparent , the border stays.

When previewed in a browser (Edge), we don’t see the lines.

Better open a support ticket.