Skip to Content
author's profile photo Former Member
Former Member

Defaulting view controls with parameters passed via URL

Hi All,

Let's say UI5 app runs via following URL (and in addition, I am passing a URL parameter param01):

http://mydomain.com:1080/sap/bc/ui5_ui5/zmyui5app/index.html?sap-client=030&param01=1000

Obviously, I can read this parameter using following statement in view controller onInit() or Component.js:

var sParam01 = jQuery.sap.getUriParameters().get("param01");


//Now sParam01 is set to 1000 from URL parameter.



Let's say we have a Select (dropdown combo box) on the view.


Can we set the default value (setSelectedItem) of this Select using sParam01?


I have tried it in all functions responsible for the creation/load of view. I can access the value and the label and the value sets ok but it is not displayed. The reason for this is binding (Select is bound to JSON datamodel) occurs AFTER onInit() and overwrites what was assigned from the parameters. I have also tried to rerender the view where possible.


The requirement is such that I have an app which defaults to certain values. Each business unit would like to see their own defaults as soon as the app loads.


What can be done to achieve this? Can someone show an example?


Thanks.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jul 27, 2016 at 11:35 AM

    Anyone?

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.