Edit this page

get

Gets the data item (model) with the specified id.

The get method requires the schema.model option to be set and the id of the model to be specified.

Parameters

id Number |String

The id of the model to look for.

Returns

kendo.data.Model the model instance. Returns undefined if a model with the specified id is not found.

Example - find a model by id

<script>
var dataSource = new kendo.data.DataSource({
  data: [
    {id: 1, name: "Jane Doe" },
    {id: 2, name: "John Doe" }
  ],
  schema: {
    model: { id: "id" }
  }
});
dataSource.fetch(function() {
  var dataItem = dataSource.get(1);
  console.log(dataItem.name); // displays "Jane Doe"
});
</script>
Is this article helpful? Yes / No
Thank you for your feedback!

Give article feedback

Tell us how we can improve this article

close
Dummy