Skip to Content

Startup optimization - MetaData load seems to be Synchronous

Hello,

I'm trying to optimize the startup time of my app, and (app)CacheBuster solves most of the problems, but I'm still unhappy with the metadata load which I can't seem to make asynchronous.

In component.js I'm calling this:

this.setModel(new sap.ui.model.odata.ODataModel(sServiceUrl, true, null, null, null, false, true).attachMetadataLoaded(this, this._onMetaLoad));

But I'm getting this timeline in Chrome:

The List.view.xml is the first view loaded by the component according to the router, but it seems to wait until the metadata load is finished before it is retrieved. The last "true" in the model creation should be setting it to asynchronous, and if I break point the code, the next instruction does run before the metadata is returned.

It seems to be asynchronous but apparently it is blocking the loading of the next element. Which is even stranger since the oData service is connection to an ECC while the SAPUI5 is running in a local web server.

Any ideas?

Thanks

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    Posted on Mar 24, 2015 at 07:14 PM

    you mised one more parameter

    var ODataModel = Model.extend("sap.ui.model.odata.ODataModel", /** @lends sap.ui.model.odata.ODataModel.prototype */ {

    -? (sServiceUrl, true, null, null, null, false, true ???????? )

    constructor : function(sServiceUrl, bJSON, sUser, sPassword, mHeaders, bTokenHandling, bWithCredentials, bLoadMetadataAsync) {

    that's why we use json settings

    sServiceUrl, {

    ...

    loadMetadataAsync : true,

    ....

    }

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Mar 24, 2015 at 08:34 PM

    Hello Joao,

    What version of SAPUI5 are you using ?

    The API doc here : JsDoc Report - SAP UI development Toolkit for HTML5 - API Reference - sap.ui.model.odata.ODataModel , the 8th parameter that you send while instantiating the oData Model determines whether the metadat call is sync/async.

    {object}bLoadMetadataAsync?

    (optional) determined if the service metadata request is sent synchronous or asynchronous. Default is false. Please note that if this is set to true attach to the metadataLoaded event to get notified when the metadata has been loaded before accessing the service metadata.


    By default the metedata is loaded sysnchronously. Please pass the highlited parameter and check.

    this.setModel(new sap.ui.model.odata.ODataModel(sServiceUrl, true, null, null, null, false,true, true).attachMetadataLoaded(this, this._onMetaLoad));


    Best Regards,

    Radhika

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Mar 27, 2015 at 12:09 PM

    It goes half way. You put one parameter outside the brackets and then named ones inside the brackets.

    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.