Hello everyone,
Here is my little concern, i have a table, a pretty normal one. What i am trying to do is this :
I'd like to be able to hide a complete column based on data. I have actually been able to hide a column completely, but my problem is that when the table breaks into a second page, the second page's header "cell" of the column i have hidden reappear.
Here is how i did my hiding :
- In the table Initialize script, i verify a condition, and if this condition is filled, i hide the header cell.
if (Verif.name4_we.rawValue == "" or Verif.name4_we.isNull) then
HeaderRow.Cell3.presence = "hidden"
endif
- For the normal rows, i still verify the exact same condition and if the condition is filled, i hide the cell.
if (data.Page1.Test.Table1.Verif.name4_we.rawValue == "" or data.Page1.Test.Table1.Verif.name4_we.isNull) then
$.presence = "hidden"
endif
This setup works pretty well if i only have one page :
5 is my header row name(i know it might be confusing i'm sorry), this is page 1, column 6 and 7 are hidden actually.
This is what happen on the next pages :
As you can see, only the header reappear, you can clearly notice that the items are still in hidden but since the header appear, it look
like there was a complete column.
Does anyone have an idea of what could be my issue?
Thanks alot!
Max
Solved! Go to Solution.
Views
Replies
Total Likes
Are you able to change the width of your columns?
Here is the final way i did it :
First of all, you have to double click on the ruler to open the Drawing Aids palettes (or go in the top menu -> palettes -> Drawing Aids) and set the Units to Points.
You need a tables and a structure, a table that will actually show the information, and a structure that will be imported from your program with the correct widths(columns to be hidden will have a value of 0.001 in the structure). The structure is hidden in the layout.
In your table initialize script, write something like this :
//Set the columns width using our imported structure.//Empty ones have a width of 0.001
var width = Concat(data.Page1.struct.col1, "pt ",
data.Page1.struct.col2, "pt ",
data.Page1.struct.col3, "pt ",
data.Page1.struct.col4, "pt ",
data.Page1.struct.col5, "pt ",
data.Page1.struct.col6, "pt ",
data.Page1.struct.col7, "pt ",
data.Page1.struct.col8, "pt ",
data.Page1.struct.col9, "pt ",
data.Page1.struct.col10, "pt")
Table.columnWidths=width
Explanation : You concatenate every rawValue of your table that contains the width of your columns with "pt " (the unit), this way you can set the widths of every columns in only one command (Table.columnWidths=width).
This should resize the whole column, including the header. (It works on my side)
Don't bother to ask if you have any other questions
Max
Views
Replies
Total Likes
The problem with columns is that there aren't any. Tables are just a series of repeating subforms, there's no column to operate on.
I've never had to try doing it but I've seen some methods for handling it.
Here's one: http://forms.stefcameron.com/2006/10/28/scripting-table-columns/
Views
Replies
Total Likes
Thanks for your reply.
I know that there are no columns to work on, this is why i am hiding every cell of the "column" to hide it. I have already tried with this link informations but i still get the same results. I am just wondering how come my script stops working on the 2nd page and onward...
Since i am hiding my cell, it should hide it in the other pages, isn't it?
Thank you!
Max
Views
Replies
Total Likes
I'm not sure what's happening. I've not tried doing this before so maybe someone else will have a better idea.
You might be able to re-hide elements when the table breaks across a page, you can check this with pageSpan(). Try it on the layout:ready event.
if (xfa.layout.pageSpan(this.parent.parent) > 1) {
do stuff;
}
Views
Replies
Total Likes
Hi Jono,
Can you explain me what the condition you sent me is doing exactly? what is it suppose to be in the parentheses?
Thank you!
Max
Views
Replies
Total Likes
The (this.parent.parent) is looking for the object that is breaking across the page, in your case the table - you should also be able to put the name of the table in there too.
I just copy and pasted that from a place I've used it before - in my case it was a button I was changing the caption on. So for me the button was in a row and I was pointing to the table it was in - the first parent is the row (subform) the button was in and the second parent is the table the row is in (you could keep going further up the hierarchy with more parents).
So you could maybe use this with a check to see if the column is supposed to be hidden or not and then hide it again. I'm just guessing at this point though.
Views
Replies
Total Likes
Thinking of it, isn't it suppose to work without the condition?
Adding a condition to my "hidden" statement is not going to help, it's only going to restrict it... :/
My problem might be before that i guess.
Views
Replies
Total Likes
The best solution i found to remove a column is this one :
in the Table initialize script, write :
Table1.columnWidths="30mm 30mm 0.001mm 30mm 29.977mm 30mm 30mm 30mm 29.763mm 30mm"
If you want to remove a column, you put 0.001mm as width, it won't appear on the screen nor on the sheet if you print it.
If you want to be more dynamic you can add conditions using variables as width for each columns.
Example :
If ( x == x ) then
varColumn1 = 30mm
else
varColumn1 = 0.001mm
endif
and then you call you .columnWidths using all your variables.
Using the unit of measure 'Point' instead of milimeter may give better results if you hide alot of columns.
I hope this answer may help some people!
Views
Replies
Total Likes
Hi,
i have the same problem as described in this post with hiding columns (cells in rows and header row).
I tried to use your solution, but I still have a problem:
The columns are not shown, but the text is still available. this causes very high column headers.
I tried to set the rawValue of the header cell to "", but after a page break, the text in trhe second header is still there.
Did you have the same problem? How to you solve it?
Thanks and best regards,
Constantin
Views
Replies
Total Likes
Are you able to change the width of your columns?
Here is the final way i did it :
First of all, you have to double click on the ruler to open the Drawing Aids palettes (or go in the top menu -> palettes -> Drawing Aids) and set the Units to Points.
You need a tables and a structure, a table that will actually show the information, and a structure that will be imported from your program with the correct widths(columns to be hidden will have a value of 0.001 in the structure). The structure is hidden in the layout.
In your table initialize script, write something like this :
//Set the columns width using our imported structure.//Empty ones have a width of 0.001
var width = Concat(data.Page1.struct.col1, "pt ",
data.Page1.struct.col2, "pt ",
data.Page1.struct.col3, "pt ",
data.Page1.struct.col4, "pt ",
data.Page1.struct.col5, "pt ",
data.Page1.struct.col6, "pt ",
data.Page1.struct.col7, "pt ",
data.Page1.struct.col8, "pt ",
data.Page1.struct.col9, "pt ",
data.Page1.struct.col10, "pt")
Table.columnWidths=width
Explanation : You concatenate every rawValue of your table that contains the width of your columns with "pt " (the unit), this way you can set the widths of every columns in only one command (Table.columnWidths=width).
This should resize the whole column, including the header. (It works on my side)
Don't bother to ask if you have any other questions
Max
Views
Replies
Total Likes
Hello Max,
thank you for your fast reply.
Yes, I am able to change the widths of the columns using scripting.
And the widths of the columns are the same on the first page and following pages.
The problem is, that I have a column-header text like "Colum Header". I can delete the text in the script using rawValue of the Header-cell,
but the text won't be deleted on the second page.
This causes a 0,001pt width column, but the header cell is very heigh, because LiveCyle tries to put in the header text in the theader cell.
Then the chars of the header-cell is written vertically like:
C
o
l
u
m
n
H
e
a
d
e
r
So, if you have any idea?
Thanks and best regards,
Constantin
Views
Replies
Total Likes
Can you send the settings of your subforms, table, header and row?
Here's mine :
Page - Flowed top to bottom
Allow Page Breaks within content
Uncheck Repeat Subform for Each Data Item
Subform - Flowed top to bottom
Allow Page Breaks within content
Check Repeat Subform for each data item
check min count : 1
Table - Allow page breaks within content
Check repeat table for each data item (leave the others unchecked)
Personnally i have a section of header, so i'll send u my config but i think you can get rid of the section.
Section - Check both Include Header row in initial page and in subsequent pages
Check Repeat Section for each data item
Check min count : 1
Header1 - Check include header row in initial page
the rest is unchecked
Header2 - Check include header row in initial page
the rest is unchecked
Header3 - Check include header row in initial page
Check Repeat row for each data item
Check min count : 1
Row - Check Allow page break within content
Check Repeat Row for each data item
Check min count : 1
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies