Mobile + MVVM View Refresh problem (only on iPad Safari)

2 posts, 0 answers
  1. Alex
    Alex avatar
    23 posts
    Member since:
    Aug 2012

    Posted 21 Sep 2012 Link to this post

    I have found very strange issue, which happens only on iPad Safari, on iPad Chrome not.
    The Mobile Split view application has on the left pane mobile listview which switches views on the right pane, as in your example, but after each switching Ajax request is made (asynchronous) to retrieve data for selected view.

    View elements are bound to view model with MVVM, for example
    <div data-bind="text:value"></div> or <input data-bind="value:value"/> etc. and Ajax update with "set" method my view model.

    Everything works good on Windows Chrome and Safari, except on iPad in Safari: sometimes MVVM DOM elements are not updated to the correct value. I'm sure the value was "set" in view model, but divs and inputs was not updated. Things I discovered in last two days:

    1. If I change focus to input, that was not correctly updated, it becomes immediately correct value
    2. if I change view to another and back,even without ajax, all divs and inputs are now updated
    3. (this one very strange but true) divs and inputs, which bound value or text was previously empty string becomes updated!! divs and input fields, which previous value was something but not empty -becomes NOT updated!! 

    So for now I use very dirty workaround set each value first to empty string, and then set it to value that came with Ajax response. 

    Question: maybe you could somehow explain why? 
    About workaround - is there any possibility to refresh view, see point 2: change view to another and back updates all fields, and I could maybe call something after Ajax response is processed?

    Again, the problem only occurs on iPad Safari. I have yesterday updated to iOS6, no difference.

    Thanks in advance.

  2. Alex
    Alex avatar
    23 posts
    Member since:
    Aug 2012

    Posted 27 Sep 2012 Link to this post

    Small update. 
    I packed my project into Cordova (Phonegap), and it works good in WebView on iPad, so I would say it is Safari bug.
Back to Top