on 09-15-2014 8:22 AM
Hi All,
I have created Master Detail demo app,in which I want to get comobox's item to detail page.I have done this thing with JSView but not able to do in XMLView.
Master View
<ComboBox id="combo1" selectionChange="test">
</ComboBox>
Master Controller
test : function(){
alert(this.byId("combo1").getSelectedItem().getText());
}
I am getting Alert value with selected item.But if I write in detail page's controller as below I am not getting value.
onInit : function() {
alert(sap.ui.getCore().byId("combo1").getSelectedItem().getText());
}
Any clue to solve this problem??
Help would be appreciated.
Regards,
Zalak Dalal
Hi Zalak,
You have to function 'EventBus' for transfer data from MasterView to DetailView.
MasterViewController
sap.ui.getCore().getEventBus().publish("app", "GetComboText", {
comboText : sap.ui.getCore().byId("combo1").getSelectedItem().getText()
});
DetailViewController
onInit: function() {
var bus = sap.ui.getCore().getEventBus();
bus.subscribe("app", "GetComboText", this._showComboText, this);
}
_showComboText : function(channelId, eventId, data){
alert(data.comboText);
}
by sapui6.com
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI Zalak
Can you do this in the onAfterRendering of the view?
-D
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
81 | |
10 | |
10 | |
9 | |
7 | |
6 | |
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.