Note that there are some explanatory texts on larger screens.

plurals
  1. POBackbone.js render a view after a getting return value
    primarykey
    data
    text
    <p>In the code below I need to render the view only after I have got valuea from a call on the Gmaps navigator. Until I have Latitude amd Longitude I can't render the view. Followinag some answers here I'm stuck with the error</p> <p>Object [object global] has no method 'afterRender Thanks for any suggestion.</p> <pre><code>initialize: function() { $.when(this.beforeRender).then(function(){ this.afterRender(); }); }, beforeRender: function () { if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(this.onSuccessUpdatePos, this.onFailUpdatePos); } else {navigator.geolocation.getCurrentPosition(this.onSuccessUpdatePos, this.onFailUpdatePos); } }, afterRender: function () { this.render(); }, </code></pre> <p><strong>UPDATE</strong>: I did as I was told, and it seems that the sequence BeforeRender-> render-> afterRender is respected. I also added all of the initialization logic within the function Initialize(). the problem is that putting the functions in the sequence appears not to ensure the fact that the function render() is launched once acquired results.</p> <p>I also tried it with </p> <pre><code> $.when(this.beforeRender).then(that.render); </code></pre> <p>as was suggested to me but still keeps giving me errors. It seems that beforeRender isn't launched. The error that keep showing me is</p> <p>Uncaught SyntaxError: Unexpected token u</p> <p>I think that happen because of sessionStorage &amp; localStorage and these are not filled before the render function is launched. is there an effective way to wait for these results to be returned?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload