on 11-06-2013 6:49 AM
Scenario: a dialog has 1 Input field and a Submit button. On pressing a Submit Button in the value from the Input field should pass to the View from which dialog is called.
1. Should I use Eventbus or there is some other way.
2. Can I pass the ID of the Submit button as well to the calling screen
-Regards
Dhrubajyoti
Hi rakshit,
Why would you open a dialog in a different view or are you using fragments, in case you are using fragments you could just give the input field a id and retreive using fragment.byId and then get the value. If you are still want to open the dialog in a different view you could just use the eventbus that's the simplest way to pass data between views.
Regards,
Pruthvi.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Rakshit,
Subscribe to the event channel in the view's controller that you need the data in
sap.ui.getCore().getEventBus().subscribe("show", "username", eventHandler, this);
in the eventHandler function
eventHandler = function (channelId, eventId, data) {
if (eventId === "username") {
alert(data.context); // data recieved in the data object will contain username that you passed.
} else {
jQuery.sap.log.error("'nav' event cannot be processed. There's no handler registered for event with id: " + eventId);
}
};
Send Data by publishing the event from the dialog view / controller.
var oEventBus = sap.ui.getCore().getEventBus(); | ||||||||||
Regards, Pruthvi. |
User | Count |
---|---|
93 | |
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.