cancel
Showing results for 
Search instead for 
Did you mean: 

hide a table column, other columns move over but do not retain their width

Former Member

Hi,

I am working on an SAP Adobe Form.

When hiding a table column, the other columns are moving over but are not retaining their width.

Table fields being displayed are:

BUDAT

REFDOCNR

GLACCT

SGTXT

TSL

Under certain conditions table fields BUDAT and REFDOCNR will be hidden.

BUDAT has a width of .8 and REFDOCNR has a width of .85.

GLACCT has a width of .6 and SGTXT has a width of 3.2.

When BUDAT and REFDOCNR are hidden, the other three fields GLACCT, SGTXT, and TSL move over and field SGTXT is truncated from 3.2 to .85 which is the width of field REFDOCNR.

Is there a way to hide a column, have the remaining fields move over, and retain their width?

Thanks in advance.

Accepted Solutions (1)

Accepted Solutions (1)

former_member365727
Active Contributor
0 Kudos

Hi,

Once the columns are hidden write script (Javascript / FormCalc) to set original width to remaining columns. I would prefer to write Javascript to adjust width. Below is the sample code which needs to be written on UI element(SGTXT) directly:

this.w = "3.2";

Regards

Srikanth KV

Former Member
0 Kudos

Hi Srikanth,

Thank you for helping.

I am hiding the columns using JavaScript in two places, the initialize event at the overflowLeader level (for the headings) and the initialize event at the data level for the fields BUDAT and REFDOCNR.

I have tried setting the width in that code:
----- data.Letter.ItemList.ITEMS.overflowLeader::initialize: - (JavaScript, client) ----------------

var thedispInd = xfa.resolveNode("xfa.datasets.data.data.AR_PRINT_HDR.KUNNR");
var aString = thedispInd.value;

//Set form field to read only
if ((aString >= '500000' && aString <= '509999') || (aString >= '900000' && aString <= '999999')){
txt_dt_of_service.presence = "hidden";
txt_ref_doc.presence = "hidden";
txt_int_order.width = "0.6951in";
txt_desc.width = "3.2143in";
txt_amt.width = "1.6545in";
}
And

----- data.Letter.ItemList.ITEMS.DATA::initialize: - (JavaScript, client) --------------------------

var thedispInd = xfa.resolveNode("xfa.datasets.data.data.AR_PRINT_HDR.KUNNR");
var aString = thedispInd.value;

//Set form field to read only
if ((aString >= '500000' && aString <= '509999') || (aString >= '900000' && aString <= '999999')){
BUDAT.presence = "hidden";
REFDOCNR.presence = "hidden";
GLACCT.width = "0.6951in";
SGTXT.width = "3.2143in";
TSL.width = "1.6545in";
}

But this didn't restore the width of the fields GLACCT, SGTXT, and TSL .

I have tried adding in the JavaScript at the initialize event at the item level
----- data.Letter.ItemList.ITEMS.DATA.SGTXT::initialize: - (JavaScript, client) --------------------

this.width = "3.2143in";

The width is still not restored.

I have also tried at the form:ready and layout:ready events at the item level, and the width is still not restored.

Any additional help is greatly appreciated

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Shari,

  You can directly write the java script on the table as below,

IF(Condition)

{

this.columnWidths = "0.4in 0.95in 2.6575in 1.7in"

}

With respect to condition(Depending on value of some fields or column) you can resize the with of each column.

Thanks,

Karthik

Former Member
0 Kudos

HI Shari,

My requirement is same like you.

How you hidden column headings if it is initial.

if i use javascript to hidden column heading it is hidden in first page only from second page

onwards the header is coming.

so how can i hidden the column heading in all pages.

Thanks in advance.

Thanks & Regards,

Pavan g

former_member221372
Participant
0 Kudos

Hello Pavan,

I am also facing the same issue.How do you solved this issue.

Thank You.

Cheers,

Bharat

Former Member
0 Kudos

Hi Bharat,

Me too facing the same issue. how do you solved this issue?

Thanks.