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

MVVM / AutoSync unwanted losing user typing

4 Answers 150 Views
MVVM
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Chris asked on 24 Apr 2017, 02:32 PM

Hi,

We have a scenario that shows a form (e.g. with field A and field B) with multiple text fields being edited using MVVM tied to a data source that’s is set to AutoSync. This datasource is tied to a remote connection, so there can be a momentary lag e.g. 1-2 secs.

What we can observe is that :-
- The user types in field A
- The user then clicks on field B, and starts typing… 
- As the field A lost focus, AutoSync has kicked in (so network request starts)
- User starts to type in field B, but then previous network request finishes and fieldB resets to the value in the datasource, effectively undoing what the user has just typed

Is this ‘expected’ behaviour? Do you know any methods (or workarounds) to prevent this?  Or do we need to disable AutoSync?

Is there any documentation about what events on html input fields that MVVM / AutoSync use, and when ?

Thanks

Chris

4 Answers, 1 is accepted

Sort by
0
Chris
Top achievements
Rank 1
answered on 24 Apr 2017, 03:27 PM

...in addition it seems that focus can get lost from field B when the save completes

Thanks

Chris

0
Accepted
Tsvetina
Telerik team
answered on 26 Apr 2017, 10:56 AM
Hi Chris,

Indeed, this is expected. The MVVM bindings are updated on focus out of an edited input. When an item in the DataSource is updated (via the MVVM binding), the auto sync feature automatically triggers a synchronization. So, it is safe to say that in a form like yours, DataSource synchronization will be triggered each time a field is edited and blurred. 

In my opinion, unless such type of synchronization is really needed, it would be better to disable it both in terms of user experience and performance. You can let the user submit the form when ready, when you can manually call the DataSource sync method to send changes to the server.

If you prefer to stay with the current set up, you can consider showing a loader on DataSource change event if e.action=="itemchange" and then hide it in the requestEnd event. You could consider using the kendo.ui.progress method for this purpose.This will prevent the user from typing in new data while the DataSource is syncing.

Regards,
Tsvetina
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Milehigh JT
Top achievements
Rank 1
answered on 02 Apr 2020, 03:19 AM
I have the same issue as the original poster. My users prefer to type values in and have them saved automatically in the background, not in batch as suggested. I can save the values as they are typed using my own save code, but I need to prevent the grid from refreshing. When the grid refreshes it erases the user's next edit. How can I prevent grid refresh? 
0
Plamen
Telerik team
answered on 03 Apr 2020, 11:15 AM

Hello,

The scenario seems quite custom and the thread is quite old - would you please try to elaborate little bit your scenario by providing some runnable sample or dojo so we could replicate it locally and be more helpful with a possible solution.

Regards,
Plamen
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Tags
MVVM
Asked by
Chris
Top achievements
Rank 1
Answers by
Chris
Top achievements
Rank 1
Tsvetina
Telerik team
Milehigh JT
Top achievements
Rank 1
Plamen
Telerik team
Share this question
or