MVVM kendoDataSource Transport Add method call

2 posts, 1 answers
  1. Anil
    Anil avatar
    11 posts
    Member since:
    Apr 2013

    Posted 03 May 2013 Link to this post

    The add method in this sample updates the local data source. Is there anyway this sample can work with a remote data source (configured using transport property). It only adds to my local collection.

    http://jsfiddle.net/derickbailey/D4g8S/
  2. Answer
    Alexander Valchev
    Admin
    Alexander Valchev avatar
    2895 posts

    Posted 07 May 2013 Link to this post

    Hello Anil,

    In this sample the DataSource is configured for using hard-coded list of items, which is why the add method modifies only the local data array.
    // A hard coded list of items to render
    var tasks = [
      { id: 1, done: false, description: "do stuff"},
      { id: 2, done: false, description: "more stuff"},
      { id: 3, done: true, description: "this stuff to do"},
      { id: 4, done: false, description: "that stuff we need"}
    ];
     
    // Build the data source for the items
    var dataSource = new kendo.data.DataSource({ data: tasks });

    If you want use remote data, you should bind the DataSource to remote data via Ajax transport.
    This demo demonstrates CRUD operations with remote transport. Pressing the "Add new record" will basically add new empty item in the DataSource.

    Kind regards,
    Alexander Valchev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top