cancel
Showing results for 
Search instead for 
Did you mean: 

Buttons in custom column of list report fiori elements

prathmeshtamhan
Discoverer

I have created a list report in sap fiori elements , created a custom column containing buttons in it , I want to disable enable button based on some condition. Binded model to that button. As shown in pic I want for docNum 1054 button containing text "Approve" to be enable for 1052 button to be disable 

prathmeshtamhan_1-1716190075173.png

 

prathmeshtamhan_0-1716190430436.png

 

 

rounak_roy
Advisor
Advisor
0 Kudos
You can defined a expression binding or model to the visible property of the Button, Ideally it should work. Also, If you can tell us more about the logic, based on which you want to enable/disable the button.

Accepted Solutions (0)

Answers (3)

Answers (3)

prathmeshtamhan
Discoverer
0 Kudos
Plz review below code tried but didnt work 
const value =  [
                {
                    "Status": true,
                    "DocNum": "10001"
                },
                {
                    "Status": true,
                    "DocNum": "10002"
                },
                {
                    "Status": false,
                    "DocNum": "10003"
                },
                {
                    "Status": false,
                    "DocNum": "1008"
                },
                {
                    "Status": false,
                    "DocNum": "1009"
                },
                {
                    "Status": false,
                    "DocNum": "1010"
                },
                {
                    "Status": false,
                    "DocNum": "1011"
                },
                {
                    "Status": false,
                    "DocNum": "1012"
                },
                {
                    "Status": false,
                    "DocNum": "1013"
                },
               
                {
                    "Status": true,
                    "DocNum": "1054"
                },
               
                {
                    "Status": false,
                    "DocNum": "1058"
                },
               
            ]
            var buttons = new JSONModel({
            buttonArray: value
            });
            this.getView().setModel(buttons, "buttonApproveModel");

<core:FragmentDefinition xmlns:core="sap.ui.core"
    xmlns="sap.m">
    <!--Column 1 Cell-->
    <Button icon="sap-icon://approvals" text="Approve Vendors" enabled="{= ${buttonApproveModel>/buttonArray} === true ? true : false }"  press="approveVendorEmail" type="Emphasized"></Button>
</core:FragmentDefinition>
sandeep_rs
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi,

As said you could use expression binding or a path-based expression. Please see the fe V4 specific section "Enabling Custom Actions Defined via Annotations" in https://sapui5.hana.ondemand.com/#/topic/cbf16c599f2d4b8796e3702f7d4aae6c for details.

Best Regards,

   Sandeep

junwu
Active Contributor
0 Kudos

just use expression binding for the attribute enabled

prathmeshtamhan
Discoverer
0 Kudos
used it but didnt worked
junwu
Active Contributor
0 Kudos
show us your code