Kendo angular grid template bindings - dataItem is a copy of the original object, changes not reflected

1 posts, 0 answers
  1. squarewave
    squarewave avatar
    11 posts
    Member since:
    Nov 2013

    Posted 29 Nov 2017 Link to this post

    using TreeList grid in Kendo UI v2017.3.1026 with AngularJS v1.6.1.

    when i define my bindings in a template like this:

        `<input ng-if=" ng-change="vm.priceChanged(dataItem)" ng-model="dataItem.currentPrice.value" />`

    it sort of works. the events do fire but I noticed that the underlying object is no longer synchronized with the rest of the page.

    dataItem appears to be a copy of the original object with additional properties, and the original [item in the collection the grid is bound to] does not get updated.

    this is of course a problem since the page has more than the grid and any changes in the grid need to be propagated to the original objects in the controller.


    I could manually find / synchronize the dataItem passed to the ng-change event with the original object in angular controller collection, but hoping there is a better way

    second issue is that modifying the kendo version of dataItem OR the original, does not immediately show up in the grid. seems like it needs to be manually refreshed? I am using k-rebind technique:

        <div id="grid" kendo-tree-list k-options="vm.treeListOptions" k-rebind="vm.dataVersion"></div>

    and in my event I call this.dataVersion++ after updating underlying collection, but this does not refresh the grid.

Back to Top