cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Fiori Elements ListReport with OData V4 - Cannot hide the Column with UI.lineItem.hidden

AvinashAmbalgi2006
Discoverer
0 Kudos
752

Hello Experts,

I am trying to build ListReport (Fiori Elements) using OData V4 based on CDS Views and UI Annotations.

For ListReport, I have used @ui.listItem[{position:10}] to display a column on the List.

To hide the column, I can use @ui.listItem[{position: 10, hidden: true}]. This works fine.

But I would like to set the visibility of Column based on a Variable like:

@UI.listItem[{position: 10, hidden: #(VARIABLE_NAME)}

When VARIABLE_NAME is true, the column should be hidden. But this does not work as expected.

Currently, the column is still displayed in the Table, but Value of the column is blank.

AvinashAmbalgi2006_0-1739531584012.png

Expected Result: Whole of the Column should be Hidden.

If I pass, proper boolean value of true or false to hidden, it works as expected.

Why I am using @ui.lineItem.hidden ? - This is because, it is required to sometimes, hide the column in the list, but display on the objectPage (next page).

UI5 Versions tries: 1.108, 1.120, 1.122

Any inputs or insights can help me a lot.

Thank you.

Regards,

Avinash Ambalgi

 

Accepted Solutions (0)

Answers (1)

Answers (1)

sandeep_rs
Product and Topic Expert
Product and Topic Expert

Hi,

This is by design and can be seen in the note in https://sapui5.hana.ondemand.com/#/topic/c0f6592a592e47f9bb6d09900de47412:

"If the path-based value for UI.Hidden evaluates to true for all rows, then only the fields are hidden and not the entire column."

The reasoning is that if the entire column were to be hidden, it causes confusion to end user when dealing with variants. For example, if currently all the rows have no values and the column is hidden and if user saves this as a variant - what should happen when this variant is restored in a context where some of the rows have a value for this column? Suddenly bringing back the column might confuse the user who saw this variant w/o the column earlier!

Best Regards,

   Sandeep

AvinashAmbalgi2006
Discoverer
0 Kudos

Thank you @sandeep_rs  for clarification and pointing out the exception.
Anyother way that you can suggest?

What I am trying is to show or hide a column based on the some factor (variable value).

 

Regards,

Avinash

sandeep_rs
Product and Topic Expert
Product and Topic Expert
0 Kudos
One possible workaround could be to use setPV() method of the table building block based on your condition. See https://sapui5.hana.ondemand.com/#/topic/3801656db27b4b7a9099b6ed5fa1d769 for more information.
AvinashAmbalgi2006
Discoverer
0 Kudos

Hi @sandeep_rs , can you please elaborate on the setPV() method? Will this be as an extension of the Fiori Element?