Set view to the initial state

6 posts, 0 answers
  1. Raja
    Raja avatar
    43 posts
    Member since:
    Oct 2013

    Posted 01 Aug 2014 Link to this post

    Hi,

    I am building a data entry screen using Kendo UI SPA. My users will do lot of data entry each day. So after filling in a form and pressing Save should save the records and again present them the same screen for data entry. How can I reset all the controls (or View Model) to initial state?

    Thanks
  2. Petur Subev
    Admin
    Petur Subev avatar
    1882 posts

    Posted 05 Aug 2014 Link to this post

    Hello Raja,

    The observable object does not provide any way to reset its properties to its initial state, I am afraid you will need to manually set each of them:

    http://docs.telerik.com/kendo-ui/api/framework/model#methods-set

    I am sorry for any inconvenience caused.

    Kind Regards,
    Petur Subev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  3. Kendo UI is VS 2017 Ready
  4. Raja
    Raja avatar
    43 posts
    Member since:
    Oct 2013

    Posted 08 Aug 2014 Link to this post

    Thank you for the response. But I am facing a problem this way also. If I set the field to a specific value, control that is bound to that value is not effected. I thought the value binding is bi-directional. Can you help?
  5. Petyo
    Admin
    Petyo avatar
    2439 posts

    Posted 12 Aug 2014 Link to this post

    Hi Raja,

    That's correct - the value binding is bi-directional. Can you reproduce the problem you are facing in the Dojo? We will take a look.

    Regards,
    Petyo
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  6. Raja
    Raja avatar
    43 posts
    Member since:
    Oct 2013

    Posted 13 Aug 2014 Link to this post

    I think I found out what I am doing wrong. I have a model property "selectedValue" which I am trying to set from a function in the model like this which is not working.

    model.selectedValue = 1;

    Below piece of code seems to be working and changes the associated dropdown selection.

    model.set("selectedValue",1);

    Thank you for your help.
  7. Petyo
    Admin
    Petyo avatar
    2439 posts

    Posted 14 Aug 2014 Link to this post

    Hello,

    this is correct, you should use the set method, as our documentation suggests in order for the bindings to update correctly. 

    Regards,
    Petyo
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
Back to Top
Kendo UI is VS 2017 Ready