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

General questions regarding app development with UI5

Hi Experts,

I have several question regarding xml fragment and controller development with UI5:

1. I have a fragment.xml witch contains a Dialog with sap.ui.unified.FileUploader control. I have defined an 'id' property on the control.

The problem is that when i close the dialog and open it again in my application it says that the Dialog could not be created because of the duplicate id of the FileUploader. In order to overcome the problem call oDialog.destroy() when i close the dialog.

Is it the correct solution for duplicate id problem ?

2. I have created a model, fragment.xml and a controller. I set the model to the fragment using setModel() method, but i want my controller to update the model either. I did not find a method on the controller that sets a model so i created a new method on the controller setDataModel() which sets the model and updates the controller private property pointing to the model.

Is it the correct solution ? Is there a way to pass my model to the controller using another api ?

3. My Dialog has FileUploader and a button that adds a tree control on the fly. Initially the dialog has does not displays the tree control.

I use Grid control to layout FileUploader and the button.

When i add the tree control i use addContent(oTree) method. It works fine.

My colleagues told me that probably the best solution will be to place an empty HTML control when i create the dialog and fill it later when user presses on the button. What do you think ?

4. The tree control that i add to the dialog on the fly is got from an asynchronous method. Is there any support in UI5 to do things asynchronously ?

Regards,

Slavik.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    Posted on Mar 27, 2015 at 06:47 AM

    Slava,

    1) do you open it OR instantiate ( sap.ui.xmlfragment(...) ) and open? when you deal with fragments - instantiate it once in onInit and reuse later on with open and close

    2) set the model to core, so you can use from any place of your app

    3) addContent should work just fine. HTML control is a very special "beast", for past 2 years i can't remember a case where I would really need to use it


    4) sapui5 has pretty much everything async, odatamodel.read has a callback + all the events it fires (RequestCompleted/RequestFailed/RequestSent)

    btw, you will get much more responses if you split your questions

    Add a comment
    10|10000 characters needed characters exceeded

    • Hello Stanislav,

      controller will be controls the execusion, if u run your application, controller will execute first and view will be next. so if u create instance in view and if u r going to control the execution from view itself then what is the need of the controller.As of my knowledge it is going opposite to MVC architecture(UI5 follows MVC). And of course in JSP u can do control by view itself but that type of application is not follows MVC.

      Thanks,

      Santhosh Gowda

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.