Binding not working even after re-wired

3 posts, 0 answers
  1. Stacey
    Stacey avatar
    56 posts
    Member since:
    Aug 2013

    Posted 27 Nov 2013 Link to this post

    I have a situation where I need to retrieve some data from my server, and then populate my view model with it. However when I do that, the bindings get overwritten. So I have a function to re-wire the functions and such for all of the various objects, and this seems to work fine; Except for this one situation where a sub-array of a top level property has an onCreate function.

    The best I can see, when I start the page, the onCreate function has a property called "guid'. When I use the set function to apply the server side data to the array, that property is taken away, and I cannot seem to get it back. So the Click event fails with an error.

    I have a jsBin sample here;


  2. Stacey
    Stacey avatar
    56 posts
    Member since:
    Aug 2013

    Posted 29 Nov 2013 Link to this post

    Been working on this for two days straight, still no success. Starting to think that it isn't even possible.
  3. Daniel
    Daniel avatar
    2231 posts

    Posted 02 Dec 2013 Link to this post

    Hello Stacey,

    The click handler should be assigned before the binding is being refreshed. In this case, before the Rails object is set in the fromJSON method. You should either assign the handler and then rebind the element:
    change: function (e) {
        // get the selected row from the grid
        var selected =;
        // get the data from the selected row
        var data = this.dataItem(selected);
        // update the model
        viewModel = new Model(data.toJSON());
        kendo.bind($("#binding-content"), viewModel);
    or create a new ObservableObject for the Rails field and assign the handler before setting it to the viewModel.

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