on 12-23-2014 4:23 PM
Hi,
how to use a expand or press or click event on Dropdownbox.
i have only one value so want to capture these events and do some logic.
Best regards,
Rohit
HI Rohit
Is it that because there is only one item in the dropdownbox that you do not get the change event?
-D
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Dennis,
I used the below way and it also worked the same way.
Thanks are your help.
Best regards,
Rohit
<!DOCTYPE html>
<html><head>
<meta http-equiv='X-UA-Compatible' content='IE=edge' />
<title>test</title>
<script id='sap-ui-bootstrap' type='text/javascript'
src='/sapui5/resources/sap-ui-core.js'
data-sap-ui-theme='sap_goldreflection'
data-sap-ui-libs='sap.ui.commons'></script>
<script>
var oModel = new sap.ui.model.json.JSONModel(
{ "countries": [
{
"name" : "Germany",
"short" : "DE"
},
{
"name" : "India",
"short" : "In"
}
]
});
var oDD = new sap.ui.commons.DropdownBox({
change : function(oEvent){
alert(sap.ui.getCore().byId(this.getSelectedItemId()).getBindingContext().toString());
}
});
oDD.setModel(oModel);
oDD.bindItems("/countries", new sap.ui.core.ListItem({text: "{name}", additionalText: "{short}"}));
// oDD.onclick(alert("Test"));
oDD.addEventDelegate({
onselect:function() {
oDD.onclick(alert("Test"));
}
});
oDD.placeAt("content");
</script>
</head>
<body class='sapUiBody'>
<div id='content'></div>
</body>
</html>
Hi Rohit
Your solution is sound.
If you are going to use this control in many other places. Then i think it is better to extend the dropbown box control in this manner.
-D
Hi Rohit,
Specify event for dropdown selection in GET_P_XXX method of that context node.
METHOD get_p_fieldname.
CASE iv_property.
WHEN if_bsp_wd_model_setter_getter=>fp_fieldtype.
rv_value = cl_bsp_dlc_view_descriptor=>field_type_picklist.
WHEN if_bsp_wd_model_setter_getter=>fp_onclick.
rv_value = 'FIELD_SELECTED'.
ENDCASE .
ENDMETHOD.
Now define the event 'FIELD_SELECTED' in event handlers and write your logic.
Thanks,
Ritu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.