This is a migrated thread and some comments may be shown as answers.

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

1 Answer 56 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Alex
Top achievements
Rank 1
Alex asked on 21 Sep 2012, 11:03 AM
Hi! 
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.

1 Answer, 1 is accepted

Sort by
0
Alex
Top achievements
Rank 1
answered on 27 Sep 2012, 04:28 PM
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.
Tags
General Discussions
Asked by
Alex
Top achievements
Rank 1
Answers by
Alex
Top achievements
Rank 1
Share this question
or