on 2015 Aug 17 11:12 AM
Hi,
I am using sap.m.CheckBox and i want excute piece (function() ) of code after selecting check box
below is my code
<CheckBox xmlns="sap.m"
id="breakdown_id"
selected="false"
visible="true"
enabled="true"
name="break_down"
activeHandling="true"
select="[oController.move]">
</CheckBox>
so how to use select event in xml?
Hi,
try
select="functionName"
functionName - function from controller
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
<CheckBox xmlns="sap.m"
id="breakdown_id"
selected="false"
visible="true"
enabled="true"
name="break_down"
activeHandling="true"
select="handleSelect">
</CheckBox>
then in the controller of the view you can write the handler
handleSelect : function(evt) { |
// here your required function.
alert("in check box select handler"); | ||
} |
Regards,
Sarbjeet
You almost had it.
<CheckBox select="handleSelect" />
and in the controller file, which belongs to the view you are using the CheckBox in, you have the following:
handleSelect : function(oEvent) {
console.log(oEvent);
}
Refer to SAPUI5 SDK - Demo Kit if you want to know that is in oEvent.
Hi Venkat,
You can proceed as below,
In view file:
<CheckBox xmlns="sap.m" id="breakdown_id" selected="false"
visible="true" enabled="true" name="break_down" activeHandling="true"
select="move">
</CheckBox>
In Controller file:
move: function(){
alert("checked");
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Venkata,
Check out the following snippet on JSBIN : http://jsbin.com/tigequmodi/edit?html,js,output
This fiddle is simple example I have created to show how to use XML Views.
Regards
Mayank Jain
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi venkat ,
<CheckBox text="{field}" selected="true" enabled="false" />
you can bind fieds from service use above formats.
If you want to use event use below format
// create a simple CheckBox
var oCB = new sap.ui.commons.CheckBox({
text : 'I want to receive the newsletter',
tooltip : 'Newsletter checkbox',
checked : true,
change : function() {if(oCB.getChecked()){alert('YES')}else{alert('NO')};}
});
With Regards,
siva
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Venkatachala,
Please refer below link
https://sapui5.hana.ondemand.com/explored.html#/entity/sap.m.CheckBox/events
Refer Below code.
<Label text="{i18n>addProductLabelDiscontinuedFlag}" />
<CheckBox selected="{newProduct>/Detail/DiscontinuedFlag}" />
I hope it will help you.
User | Count |
---|---|
66 | |
10 | |
10 | |
10 | |
10 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.