Skip to Content
0

Enabling all Check Box using single Button in SAP UI5.

Mar 29, 2017 at 07:22 AM

116

avatar image
Former Member

Hello All,

I am trying to enable All the CheckBox on my screen using single button click. But i am not able to do that i have tried many things but it is not working. Please help me.

Check1.view.XML

<mvc:View controllerName="CheckBox.controller.check1" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:mvc="sap.ui.core.mvc"
	displayBlock="true" xmlns="sap.m">
	<App>
		<pages>
			<Page title="{i18n>title}">
				<content>
					<VBox>
						<Button text="Select All" press="onPress"/>
					</VBox>
					<VBox>
						<CheckBox text="Option a" id="cb"/>
						<CheckBox text="Option b" name="cb"/>
						<CheckBox text="Option c" name="cb"/>
						<CheckBox text="Option d" name="cb"/>
						<CheckBox text="Option e" name="cb"/>
						<CheckBox text="Warning" valueState="Warning" name="cb" />
						<CheckBox text="Error" valueState="Error" name="cb"/>
					</VBox>
				</content>
			</Page>
		</pages>
	</App>
</mvc:View>

Check1.controller.js

sap.ui.define([
	"sap/ui/core/mvc/Controller"
	
	
], function(Controller) {
	"use strict";


	return Controller.extend("CheckBox.controller.check1", {
		onPress: function() {
		sap.m.MessageBox.alert("Hii all");
			//alert("Hi all");
			
			
	this.getView().byName("cb").setEnabled(true);
			
			
		}


	});
});


Even Alert message is also not getting dispalyed.

Please help me solve this.

Thanks & regards,

Urvish Panchal

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
A K Mar 29, 2017 at 11:50 AM
1
Show 3 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Hi Karthik,

Thanks for your answer but it is still not working as desired

Thanks & regards,

Urvish Panchal

0

Where you are facing an issue?... Above example have 2 buttons to selectAll and Deselect All, you can follow up the same core or create a new plunkr with your existing code.This will make a clear view to answer your question :)

Can you try now?

http://plnkr.co/edit/L1Fnw2bSqzVoIh7tYgrg?p=preview

1
Former Member

Hello Karthik,

Issue got resolved.

Many many thanks to you :)

Thanks and regards,

Urvish Panchal

0