on 12-27-2016 8:25 AM
Hi All,
I am trying to develop a Salesforce app using viz frame controls.
For "Monthly sales performance", I have to choose the year from the Combobox or select control and pick the selected value and pass it to the Odata dynamically.
Please tell me how to get selected value from the Combobox?
Here's my coding below:
View.xml:
<core:View xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m" controllerName="sales_force.piescreen" xmlns:viz="sap.viz.ui5.controls" xmlns:html="http://www.w3.org/1999/xhtml"> <Page title="SALES ORDER OPEN" showNavButton="true" navButtonPress="onBac">
<Label text="Choose Year" />
<content> <Select id="selectId" text="/items" change ="onSelect" >
<items> <core:Item text="2016"/> <core:Item text="2014"/> <core:Item text="2015"/> <core:Item text="2014"/> <core:Item text="2013"/> <core:Item text="2012"/> <core:Item text="2011"/> <core:Item text="2001"/> <core:Item text="2000"/> <core:Item text="1999"/> </items> </Select> </content> <Button id = "btn" text="Click" press="onClick"/>
<content> <viz:VizFrame xmlns="sap.viz" id="idpie" width="100%" vizType="pie" > </viz:VizFrame> </content> </Page> </core:View>
view.controller.js:
onSelect:function(oEvent)
var aItems =oEvent.getSource().getBindingContext("text").getValue();
alert(aItems);
var selectedVal1 = this.getView().byId('selectId').getLiveValue();
alert(selectedVal1);
Please suggest.
Hello Lalitha ,
Please try this code :
event.oSource.getSelectedItem().getTitle()
I got the required output as this is for the list, and i got the title of the selected item.
Now u want for the Combobox, so u can try with getText()
Thanks,
DEEPAK.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I got it fixed with the above suggestions.
Thanks for the replies.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
https://sapui5.hana.ondemand.com/#docs/guide/e5310932a71f42daa41f3a6143efca9c.html
use binding, the selected value will be in model, you don't have to go to ui control to get the value.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
91 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.