MVVM / AutoSync unwanted losing user typing

5 posts, 1 answers
  1. Chris
    Chris avatar
    27 posts
    Member since:
    Jul 2004

    Posted 24 Apr 2017 Link to this post

    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

  2. Chris
    Chris avatar
    27 posts
    Member since:
    Jul 2004

    Posted 24 Apr 2017 Link to this post

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

    Thanks

    Chris

  3. Answer
    Tsvetina
    Admin
    Tsvetina avatar
    2481 posts

    Posted 26 Apr 2017 Link to this post

    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.
  4. Milehigh JT
    Milehigh JT avatar
    7 posts
    Member since:
    Dec 2018

    Posted 01 Apr 2020 in reply to Tsvetina Link to this post

    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? 
  5. Plamen
    Admin
    Plamen avatar
    3080 posts

    Posted 03 Apr 2020 Link to this post

    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.
Back to Top