Edit this page

setDataSource

Sets the data source of the widget.

Parameters

dataSource kendo.data.DataSource

The data source to which the widget should be bound.

Example - set the data source

<div id="grid"></div>
<script>
$("#grid").kendoGrid({
  columns: [
    { field: "name" },
    { field: "age" }
  ],
  dataSource: [
      { name: "Jane Doe", age: 30 }
  ]
});
var dataSource = new kendo.data.DataSource({
  data: [
    { name: "John Doe", age: 33 }
  ]
});
var grid = $("#grid").data("kendoGrid");
grid.setDataSource(dataSource);
</script>