How to modify height of textfield of repeating table using Javascript | Community
Skip to main content
Level 2
October 31, 2019
Solved

How to modify height of textfield of repeating table using Javascript

  • October 31, 2019
  • 19 replies
  • 21790 views

Hello guys,
I need to change, by javascript code, the height of a textfield of a table repeatable n times and connected to a data connection, in order to have the same height for each textfield of each repeatable table.

Below is a screenshot of the structure of my form:

This is my Javascript code written in event layout:ready of subform "subTab":

var numTab = xfa.resolveNodes("Table1[*]").length;

var heightTab = [];

var heightTabMax = 0;

for (var i=0; i<numTab ;i++){

    heightTab[i] = xfa.layout.h(xfa.resolveNode("Table1["+i+"]").Row2.COL_VAL, "cm");

    if (heightTab[i]>heightTab[i-1]){

        heightTabMax = heightTab[i];

    }

   

}

xfa.host.messageBox("heightTabMax: "+heightTabMax);

for (var j=0; j<numTab ;j++){

    xfa.resolveNode("Table1["+j+"]").Row2.COL_VAL.h = heightTabMax + "cm";

    xfa.host.messageBox("h: "+xfa.resolveNode("Table1["+j+"]").Row2.COL_VAL.h);

}

The only instruction that does not work on my Javascript code is the assignment of the recovered height or the following line:

xfa.resolveNode("Table1["+j+"]").Row2.COL_VAL.h = heightTabMax + "cm";

the value printed with the instruction xfa.host.messageBox("h: "+xfa.resolveNode("Table1["+j+"]").Row2.COL_VAL.h) is correct but in preview pdf I do not see the desired result but I see this:

Can you help me find the solution to this problem?

Thank you,

Francesca

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Magus069

It is possible to have tables next to each other within a "Flowed" content, right under the Content drop down, there's the "Flow Direction" option and if you select "Western Text" option, it will allow items to place automatically next to each other instead of "Top to Bottom".

19 replies

Magus069
Level 10
November 13, 2019

Technically you can have this option available within master pages if you wrap the content inside a subform.

Level 2
November 14, 2019

I thought about it and tried too, but as the following images show, I can't check the "repeat subform for each data" option on the subform that contains the table and even on the table

radzmar
Level 10
November 14, 2019

Have you tried to define Row1 as header row in the existing table?

Magus069
Level 10
November 14, 2019

Don't forget to set your subform as "Flowed" content... the options to repeat subform/table for each data item will always be unavailable when the parent content holder is "Positioned" content

Level 2
November 15, 2019

Hi Radzmar,
Thanks for the reply.
It would not be useful to define Row1 as a header line as it is not repeatable. In my form, as the image shows, the Table1 object is repeatable, not the row1.

Level 2
November 15, 2019

I can't set my subform as "Flowed" because I wouldn't get what I want, the tables repeatable next to each other because for me they are actually columns that need to be repeated n times for n columns contained in the data connection

Magus069
Magus069Accepted solution
Level 10
November 15, 2019

It is possible to have tables next to each other within a "Flowed" content, right under the Content drop down, there's the "Flow Direction" option and if you select "Western Text" option, it will allow items to place automatically next to each other instead of "Top to Bottom".

Level 2
November 15, 2019

I think I didn't explain myself well. the tabHeader table is connected to the data connection as it can have from 0 to max 10 occurrences because for me they would be the columns of the installation of my table.
So, I just set the subform to Flowed and Western text on the page but if I have to use this table in the master page, if I set the subForm like this, I don't have the possibility to repeat my table from 0 to 10 times

Magus069
Level 10
November 15, 2019

I'm sorry, I thought it wasn't that hard to do such a thing. Either my solution or radzmar is supposed to work, but if you can't seem to fit a solution for your issue... I don't think I could be of any help here.

Good luck