Skip to Content
avatar image
Former Member

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

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.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Jun 02, 2017 at 07:21 PM

    You can use expression binding like below:

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

    <Button visible="{= ${model>field} === 0 ? true : false }" />
    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      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

  • avatar image
    Former Member
    Jun 02, 2017 at 01:16 PM

    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.

    Add comment
    10|10000 characters needed characters exceeded