Modify one field in a MVVM DataSource

2 posts, 1 answers
  1. Dr.YSG
    Dr.YSG avatar
    210 posts
    Member since:
    Dec 2009

    Posted 26 Jun 2013 Link to this post

    I have a DataSource that I am using as the VM for a Grid.

    After the reader grabs the data, I have a change event that I need to run to compare what is local (in an indexed db) with what was fetched.

    In the snippet below I set row[i].Newer to false if the data is not newer.
    Then I trigger the change on the ObservableObject.

    This is all working fine, until I do a "cancel changes" from the Grid Toolbar. which seems to reset things.

    How should I be updating the DS?
    if (vm.oldTest(,, dbm.LayerInfo)) { = false;"change");
  2. Answer
    Petur Subev
    Petur Subev avatar
    1882 posts

    Posted 28 Jun 2013 Link to this post


    The dataSource of the Grid keeps copy of the 'original' dataItems (it saves it when the Grid is bound) and when the cancelChangs is invoked - all the items from that pristine collection are used and all other changes applied are lost.

    If sync of the dataSource is called - on success the pristine collection is updated with these successfully updated dataItems.

    Kind Regards,
    Petur Subev
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top