Problem with Add in MVVM with Icenium

2 posts, 0 answers
  1. Chris
    Chris avatar
    29 posts
    Member since:
    Mar 2009

    Posted 01 Jul 2013 Link to this post

    Started with the Icenium / Everlive / Kendo MVVM example. My add model for the class YFKey (name, description, status) is as follows:

        window.addYFKeyViewModel = (function () {
            var $newName, $newDescription, $newStatus;
            var validator;
            var init = function () {
                validator = $('#enterStatus').kendoValidator().data("kendoValidator");
                $newStatus = $("#newStatus");
                $newName = $('#newName');
                $newDescription = $('#newDescription');
            var show = function () {
            var saveYFKey = function () {
                alert("In saveYFKey");
                if (validator.validate()) {
                    var items = YFKeysModel.YFKeys;
                    var item = items.add();
                    item.Name = $newName.val();
                    item.Description = $newDescription.val();
                    item.Status = 0;
                    item.IsSystem = false;
                    item.UserId = usersModel.currentUser.get('data').Id;
          'sync', function () {
            return {init: init, show: show, me: usersModel.currentUser, saveYFKey: saveYFKey};

    This is accessed by an "Add" button from the listview of YFKeys (working fine) modeled exactly after the activities class within the example. Problem is this: AFTER I do an Add to the class YFKey, give new data, and hit the Save button, Everlive database IS properly updated, but the new item is in my listview with blank values, i.e., no name, and no description.

    Not sure - probably an asynch problem? Not clear what the "one" function in your example does...

    Any ideas?
  2. Petyo
    Petyo avatar
    2444 posts

    Posted 03 Jul 2013 Link to this post

    Hi Chris,

    I am not sure what goes on in your case. It is unlikely that the problem is caused by the async call, though. Can you try reproducing the problem in an isolated case? You may use the jsbin service.

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