Skip to Content

SAPUI refresh view file example: MyList.view.xml

The question may seem strange. I have an application which allows the users to choose the columns appearing on a form/list. I prefer sending the forms as an xml view. To me is easier to understand/debug for a program team. A servlet creates my views - thus my views are not static. I know there are advantages and disadvantages to every approach. Personally, I find a lot of js code a bit of a mess.

So the example is:

User goes to a screen MyList.view.xml.

The user decides to create a new calculated field in the view.

Field: Outstanding Amount

Value: amount - #sum(obligationPayments.![oblPaymentAmount]) (SPEL syntax.)

Without reloading the entire app I would like to force the front end to reload MyList.view.xml. Is that possible?


Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    Posted on Oct 04, 2018 at 01:56 PM

    Using javascript in a controller you would need to get a reference to the form or list and then use the appropriate function to add whatever you are trying to add. An example

    https://stackoverflow.com/questions/46953184/adding-new-column-to-the-existing-table-on-ui5

    Regards,

    Jamie

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 04, 2018 at 10:31 AM

    Don't think you can do it, maybe if somehow you load your XML with AJAX but this is not how UI5 is thought to be used.

    If you want to build the page from backend or from another app, I would recommend you to create a Z table on your backend and to insert all the components you want to create. After create an EntitySet wich returns it.

    On the end, on the onInit method of your app controller, do read request and read the table. and build all the components and insert them in the view using JS.

    Also it's much easier to debug this way.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 23, 2018 at 08:09 AM

    In short - I decided to use fragments to load Tables. My back end is cross-tab aware. It is also aware of custom columns. The backend can handle dynamic table fragments easily. A cross tab is data dependant and thus a view would never work.

    I agree that javascript is good for very dynamic columns. But the minus is that it takes a lot of js code and I do not find it simple for a tech support person to work with. A fragment can be degugged by clicking F12- Network connections. The Smart Filter Bar is an example of a nice js solution, but for some Entities it does not work. (Blank screen the odata connections are fine.) Finding the issue with it is not easy.

    So, I decided for dynamic fragments that change depending on the inputs.

    I understand that the answers are correct for the question.

    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.