cancel
Showing results for 
Search instead for 
Did you mean: 

how make the button and text visible and invisible dynamically in sap.m.table column?

RaviKant_Ranjan
Participant
0 Kudos
9,626

My requirement:

i have used sap.m.table and column fields are installment 1, installment 2. Now at the time of page first it will check in database table that whether the installments columns are 0 or not. If its 0 then i need to show the the buttons "Pay Now" in my column of sap.m.table and if the database column is not 0 (i.e. installment is paid) then instead of button it should show the value (i.e. amount paid) from the database column. I am using sap web IDE

Please help me.

Accepted Solutions (0)

Answers (2)

Answers (2)

maheshpalavalli
Active Contributor

You can use expression binding like below:

https://sapui5.hana.ondemand.com/#docs/guide/daf6852a04b44d118963968a1239d2c0.html

<Button visible="{= ${model>field} === 0 ? true : false }" />
RaviKant_Ranjan
Participant
0 Kudos

my code is in xml view is:

<HBox>

<Link text="PAY NOW" enabled="{= ${course>stud_payment_instal_1} === 0}" emphasized="true" id="lnk" visible="{= ${course>stud_payment_instal_1} === 0 ? true : false }"></Link>

<Link text="{course>stud_payment_instal_1}" enabled="{= ${course>stud_payment_instal_1} !== 0}" emphasized="true" id="lnk1" visible="{= ${course>stud_payment_instal_1} !== 0 ? true : false }"></Link>

</HBox>

this is the output what i am getting after using expression binding in table cell:

in first column the output should be pay now with enabled link because installment paid is zero but what i am getting is zero with enabled link

in second column the output should be value of installment field with disabled link because installment paid it is not zero but what i am getting is value of installment field with enabled link

the values in all the column is set according to condition satisfied in the last row of the table

Former Member
0 Kudos

Add button to the column. Have another field in the model to set visibility flag and bind this flag to the button. Conditionally change this field based on the conditions mentioned above.