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

How to make Dynamic visibility of custom action in manifest.json with OData V2? #68

Closed harelyshau closed 7 months ago

harelyshau commented 11 months ago

Issue description

Hello!

I am using Fiori Elements with OData V2 and I added custom action in Header on ObjectPage in manifest.json.

"Header": {
    "Actions": {
        "MyCustomAction": {
            "text": "Custom Action",
            "press": "onPressMyCustomAction",
            "applicablePath": "ui>/editable"
        }
    }
}

I want to show my button only in view mode, but in edit mode I want to hide this button. I found this property applicablePath but as I understand it works only with path to some field, but I don't know how to make it works with inverted value something like this "applicablePath": "!{ui>/editable}".

In my case "applicablePath": "ui>/editable" it is shown in edit mode, but in view mode is hidden. Is there some option to make it work with inverted value (!true to make it false)?

I know that in OData V4 applications we can make basic expression binding in visible property of action. Something like this:

"actions": {
    "MyCustomAction": {
        "press": "onPressMyCustomAction",
        "text": "Custom Action",
        "visible": "{= !{$ui>/editable} }"
    }
}

Is it possible to make something similar with OData V2 Fiori Elements?

Feedback Type (Optional)

clarity

Page Title on SAP Help Portal (prefilled)

Additional Features in SAP Fiori Elements for OData V2 Action for the object page header

Page URL on SAP Help Portal (prefilled)

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

KvM2 commented 11 months ago

Hi @harelyshau , Thanks for your contribution! Is this still related to the documentation? Or is it related to https://github.com/harelyshau)](https://github.com/SAP-docs/sapui5/issues/67 ? Because to me, it looks like this is more of a development topic.

harelyshau commented 11 months ago

https://github.com/harelyshau)](https://github.com/SAP-docs/sapui5/issues/67

Hi! My question: is there some option to do with OData v2 same thing like OData v4 (expression binding for visible property of custom action in manifest.json)? I have not found it in your documentation that's why made a ticket. Maybe it's about development, but my question still relevant for documentation also I think.

KvM2 commented 11 months ago

Hi Pavel, thanks for the clarification . We will look into this further. Best, Katja

ArunBharathiKumarasamy commented 11 months ago

I am using Fiori Elements with OData V2 and I added custom action in Header on ObjectPage in manifest.json.

Could you please check the below v2 documentation. https://sapui5.hana.ondemand.com/sdk/#/topic/4754094fbf4046e88271d9ca881ceaa1

harelyshau commented 11 months ago

Thanks. I have checked it, but which property in manifest.json I need to use to make it works. I find only "applicablePath", but as I see it doesn't work with expression binding.

ArunBharathiKumarasamy commented 11 months ago
visible

For enabling expression binding for the visibility property of an action button, please make use of the SAPUI5 Visual Editor to create a property change as described in the documentation. The manifest property 'visible' for custom action is available only in oData v4.

harelyshau commented 11 months ago

@ArunBharathiKumarasamy thanks for the answer. But my question was about OData V2. As I understand there is no any way to make it Dynamic with expression binding in OData V2, only in V4. Could you confirm it if it's correct?

ArunBharathiKumarasamy commented 11 months ago

@ArunBharathiKumarasamy thanks for the answer. But my question was about OData V2. As I understand there is no any way to make it Dynamic with expression binding in OData V2, only in V4. Could you confirm it if it's correct?

It is possible (in v2) via the UI adaptation as described here https://sapui5.hana.ondemand.com/sdk/#/topic/4754094fbf4046e88271d9ca881ceaa1.

harelyshau commented 11 months ago

@ArunBharathiKumarasamy thanks for the answer. But my question was about OData V2. As I understand there is no any way to make it Dynamic with expression binding in OData V2, only in V4. Could you confirm it if it's correct?

It is possible (in v2) via the UI adaptation as described here https://sapui5.hana.ondemand.com/sdk/#/topic/4754094fbf4046e88271d9ca881ceaa1.

I don't use SAP Web IDE as in this guide. I use SAP Business Application Studio with CDS Annotations because it's CAP project. Any alternative for BAS?

ArunBharathiKumarasamy commented 9 months ago

@ArunBharathiKumarasamy thanks for the answer. But my question was about OData V2. As I understand there is no any way to make it Dynamic with expression binding in OData V2, only in V4. Could you confirm it if it's correct?

It is possible (in v2) via the UI adaptation as described here https://sapui5.hana.ondemand.com/sdk/#/topic/4754094fbf4046e88271d9ca881ceaa1.

I don't use SAP Web IDE as in this guide. I use SAP Business Application Studio with CDS Annotations because it's CAP project. Any alternative for BAS?

In the BAS the Page Editor should allow you to create the change manually file during the development. If the option create the change file for the custom action buttons is not available then kindly raise the same query here https://answers.sap.com/tags/73555000100800002345.

mishuagrawal commented 9 months ago

Hello @harelyshau

Is your concern resolved now? Please let us know.

Thanks and regards, Mishu Agrawal

harelyshau commented 6 months ago

Seems it's not actual for me already. We are using simple logic in JS for that: this.byId('buttonId').bindProperty('visible', 'ui>/editable', (b) => !b);

Thanks for support.