cancel
Showing results for 
Search instead for 
Did you mean: 

how to set a visibility for a table column in SAP UI5 through APIs

former_member214868
Participant
0 Kudos

Hi,

I am using SAP UI5 1.28 and the sap.m.Table control to display the details of a search pattern.

I need to dynamically show/hide few columns based on various conditions and this can't be done with simple expression binding for the column attribute.

I have a complex search screen and based on the selection criteria, I need to show/hide the column through JavaScript APIs.

I have the table with id "itemTable" and the column id as "column1".

Please let me know the APIs/sample code to hide the above column.

Thanks,

Accepted Solutions (0)

Answers (3)

Answers (3)

former_member227918
Active Contributor
0 Kudos

Hi Urmila,

you can add one more property in your existing view model on init and based on condition just set that property to true/false, check below link:

Show/Hide column - JSFiddle

Regards,

Akhilesh

junwu
Active Contributor
0 Kudos

bind visible to model attribute,  after you done the complex calculation, you set true/false to that model attribute

francesco_alborghetti
Active Participant
0 Kudos

Hi,

probably I missed something, but sap.m.column has method setVisible and getVisible, can this be an option? Like in this jsfiddle:

https://jsfiddle.net/falborgh/19do8o47/