cancel
Showing results for 
Search instead for 
Did you mean: 

Navigation from XML View to JS View

0 Kudos

Hi All -

I am facing a roadblock in my UI5 Application.  I have a 'Button' in my Main View and would like to navigate to Detail View upon click of this button.  I am able to do this only when I create the Detail view as an XML view.  However I do not know how to navigate if I create the Detail View as JS View.

Using this to navigate to XML View: (From Main View Controller)

  handleCreate : function (evt) {

  var context = evt.getSource().getBindingContext();

  this.nav.to("Customer", context);

  },

What should be the equivalent code in order to navigate to a JS View.  Please note that the Main View is an XML View and the new View which I need to navigate is a JS View.

Thanks,

Vijay

Accepted Solutions (0)

Answers (2)

Answers (2)

qmacro
Developer Advocate
Developer Advocate
0 Kudos

What are you using for navigation? How have you defined the XML view (the ID, for example)? Are you within an App/SplitApp type context? Can you show us a bit more of your code, for example in a Gist?

thanks

dj     

0 Kudos

Hello DJ -

I am using the code from CD168 as the base code for development of my application.  I have added a button called 'Create Customer' in the XML View - Master.view.xml

When I click on 'Create Customer' button - I want to navigate to a new View (on the right side of Split).  I could successfully do this by creating an XML View called Customer.view.xml.  The view is called from the view controller Master.controller.js.

However I want to achieve this by using a JS View instead of XML View.  As shown above, I cannot use this.nav.to in order to navigate to JS View.  What should be done in order to navigate to my new JS View.

I have already created a new JS view called Customer.view.js and added the input elements in createContent : function(oController) {.....}.  But not sure how to navigate to this view.

Thanks,

Vijay

qmacro
Developer Advocate
Developer Advocate
0 Kudos

Ok, so please show us any error messages from the browser console, and also make your code available, as it may well be related to something we can't see in this thread. See http://scn.sap.com/docs/DOC-50988 for info.

thanks

dj     

0 Kudos

Hello DJ -

I have made my code available in the below gist:

https://gist.github.com/anonymous/e247b8097b6a1ce99cd9

I have taken the example from myFiori0 (CD163) and made the following changes:

1.  Added a new JS view - Tile.JS.View - which is the first view to be displayed.  On clicking the tile, I wanted to navigate to the Master View.

2.  Made changes to App.view.js to load the Tile page.  However this does not seem to be working.  Tried debugging in Chrome but not able to find the issue.

Appreciate if you can guide where I have made the mistake in calling the views.

Thanks,

Vijay

former_member190655
Participant
0 Kudos

Hi Vijay,

Did you found a solution to your issue? If yes, please share it with us.

I am stuck on almost similar thing - Navigation from XML view to JS View

Trying to navigate via routing method in Component.js - but not reaching the JS view.

In console, the app is searching for xml view and giving not found error

~Regards,

Chet

surendra_pamidi
Contributor
0 Kudos

Hi Vijay,

If you want to go from one view to another view, you can use follow method..

Create two functions for both views in controller and call a function from Main view to controller after clicking button. After that you can call the second function of Detail view from the function of Main view in controller. You can do whatever you want inside the Detail view function.

For example,

A() from Main view and B() from Detail view.

Then,

call B() of Detail view inside A() in controller.

A:function({

sap.ui.controller('controllername').B();

})

This might help..

Regards,

Surendra.