This is a migrated thread and some comments may be shown as answers.

MVVM kendoDataSource Transport Add method call

1 Answer 54 Views
MVVM
This is a migrated thread and some comments may be shown as answers.
Anil
Top achievements
Rank 1
Anil asked on 03 May 2013, 04:24 PM
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/

1 Answer, 1 is accepted

Sort by
0
Accepted
Alexander Valchev
Telerik team
answered on 07 May 2013, 07:24 AM
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!
Tags
MVVM
Asked by
Anil
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
Share this question
or