Skip to Content
0

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

May 11 at 01:29 PM

32

avatar image
Former Member

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)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Arnaud Buchholz
May 11 at 02:05 PM
0

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

For instance:

enabled="{= ${PRICE} >= 0 }"
Show 1 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Thank you Arnaud Buchholz,

I have tried above answer it is working fine.


0