Skip to Content
avatar image
Former Member

How to disable a button in new sap.m.Button

Hi Guy's

if price less than zero and select "BUY" option all "BUY" buttons should be disable in detail page list

 				venderdata:function(sKey){
			var oTable = this.byId("idTblVendor");
			var url = "/VendorData('"+sKey+"')/Results";
			var itemTemplate = new sap.m.ColumnListItem({
					// type: "",
					
				cells: [
						new sap.m.Text({
							text: "{VENDOR_NO}"
						}),
						new sap.m.Text({
							text: "{VENDOR_NAME}"
						}),
						new sap.m.Text({
							text: "{PRICE}"
						}),
                       new sap.m.Button({
                       	key: "key1",
                        text: "QUOTE",
                        }),
                         new sap.m.Button({
                       	key: "key2",
                        text: "BUY",
                       press: function() {
					// what should i write here
                             }
  })
]
			});
			oTable.bindItems({
				path: url,
				template: itemTemplate
			});
		},

capture.jpg (19.4 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    May 11 at 02:05 PM

    One way would be to bind the enable property of each button to an expression testing your condition.

    For instance:

    enabled="{= ${PRICE} >= 0 }"
    Add comment
    10|10000 characters needed characters exceeded