SAP-docs / sapui5

This is the markdown version of the official SAPUI5 documentation from the SAPUI5 Demo Kit for external contributions.
Creative Commons Attribution 4.0 International
72 stars 119 forks source link

Dynamic hiding/showing columns with OData V2 and CDS Annotations #67

Closed harelyshau closed 9 months ago

harelyshau commented 11 months ago

Issue description

Hello.

I am using odata v2 with adapter from v4 (because we are using CAP Model). And I see in your documentation this example to dynamically show/hide coulmns in table.

DataField Records in Tables

To hide table columns, the UI.Hidden path needs to refer to the property of the header instance, for example:

In the following example, STTA_C_MP_Product is the entity set of the object page header and STTA_C_MP_ProductText is the entity set of the smart table on the object page, and to_Product is the navigation property from STTA_C_MP_ProductText to STTA_C_MP_Product.

But I am using cds annotations and trying to do the same. But there is no some affect when I put it in LineItems Annotation. It works well in FieldGroup, but not in LineItems.

My question: how I can make dynamic visible of columns with OData V2 and cds annotations?

image image image image

Feedback Type (Optional)

clarity

Page Title on SAP Help Portal (prefilled)

Additional Features in SAP Fiori Elements for OData V2 DataField Records in Tables

Page URL on SAP Help Portal (prefilled)

https://sapui5.hana.ondemand.com/sdk/#/topic/ca00ee45fe344a73998f482cb2e669bb.html

KvM2 commented 11 months ago

Hi @harelyshau , thanks for your contribution. We appreciate it and will look into this.

ArunBharathiKumarasamy commented 11 months ago

@harelyshau : The property isHidden is associated via the navigation property 'Parent' to the PO Lines. So an association set describing the same (POLines to Parent) should be available in the metadata along with the Parent to POlines association. If possible could you please share your project so that we can check and respond ?

harelyshau commented 11 months ago

@harelyshau : The property isHidden is associated via the navigation property 'Parent' to the PO Lines. So an association set describing the same (POLines to Parent) should be available in the metadata along with the Parent to POlines association. If possible could you please share your project so that we can check and respond ?

Hello!

Unfortunately, I can't provide you this code right now, I can try to make a simplified version a little later and give you access to it.

However, I want to note that in the screenshots I provided the annotations that I use and they show that Parent.isHidden is successfully obtained and displayed in the column near.

I would be happy with at least one working example of dynamically hiding an entire column using some field in the parent entity with OData V2 and CDS Annotations. Do you have one?

ArunBharathiKumarasamy commented 11 months ago

@harelyshau : The property isHidden is associated via the navigation property 'Parent' to the PO Lines. So an association set describing the same (POLines to Parent) should be available in the metadata along with the Parent to POlines association. If possible could you please share your project so that we can check and respond ?

Hello!

Unfortunately, I can't provide you this code right now, I can try to make a simplified version a little later and give you access to it.

However, I want to note that in the screenshots I provided the annotations that I use and they show that Parent.isHidden is successfully obtained and displayed in the column near.

I would be happy with at least one working example of dynamically hiding an entire column using some field in the parent entity with OData V2 and CDS Annotations. Do you have one?

Please check this example where the column 'Sub-Property 2' can be hidden based on the header property 'Hide subProperty column'. https://sapui5.hana.ondemand.com/test-resources/sap/suite/ui/generic/template/demokit/flpSandbox.html#Demo-ObjectPagePathSupport&/?sap-iapp-state=TAS2NH2B5OK2FWOA7SERMKD6GR4D9TKKN5RRH8NEV&sap-iapp-state--history=TASKFLOD13D8G3QNAJ5QABYDFO4A6VAHRFHFRG07R

harelyshau commented 11 months ago

Thanks for quick answer. As I see you use here XML Annotations. And my question was about CDS.

If I'm wrong could you provide me your annotations.cds file (or another named file where you made this settings).

harelyshau commented 11 months ago

@ArunBharathiKumarasamy do you have any updates?

ArunBharathiKumarasamy commented 11 months ago

@ArunBharathiKumarasamy do you have any updates?

For SAP Fiori elements implementation related queries kindly post here https://answers.sap.com/tags/ed5c1ef6-932f-4c19-b2ba-1be375109ff5

mishuagrawal commented 11 months ago

Hello @harelyshau,

Is your concern addressed now? Can I close this issue as well as https://github.com/SAP-docs/sapui5/issues/68#event-9933072864 this one? I feel they both are similar.

Please do let me know.

Thanks and regards, Mishu Agrawal

mishuagrawal commented 10 months ago

Hello @harelyshau,

Can you please confirm if your concern is resolved?

Thanks and regards, Mishu Agrawal

harelyshau commented 10 months ago

https://answers.sap.com/tags/ed5c1ef6-932f-4c19-b2ba-1be375109ff5

@ArunBharathiKumarasamy can you answer which annotations do you use in example that you provided. I'm interested in CDS annnotations and OData v2 as you can see in title of issue?

I will check the link that you attached but I've not found this solution so far.

harelyshau commented 10 months ago

For SAP Fiori elements implementation related queries kindly post here https://answers.sap.com/tags/ed5c1ef6-932f-4c19-b2ba-1be375109ff5

Hello @mishuagrawal. I don't think so. I've not got any example with stack that I described (OData V2 & CDS Annotations). And another issue that you attached doesn't link with this one. It's really another question.

ArunBharathiKumarasamy commented 9 months ago

For SAP Fiori elements implementation related queries kindly post here https://answers.sap.com/tags/ed5c1ef6-932f-4c19-b2ba-1be375109ff5

Hello @mishuagrawal. I don't think so. I've not got any example with stack that I described (OData V2 & CDS Annotations). And another issue that you attached doesn't link with this one. It's really another question.

The annotation that you have mentioned here should work and I anticipate the problem is with the missing association to the parent. To analyze the issue further please post the query in "https://answers.sap.com/tags/ed5c1ef6-932f-4c19-b2ba-1be375109ff5".

harelyshau commented 9 months ago

Hello.

Your colleague has already helped me. Issue was in our data model. I wrote wrong Association relationship between Parent and Child entities. So if anyone else faces with similar problem, don't forger about using $self in condition of Association (if you use SAP CAP).

Thanks for support.