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


uid String

The uid of the model to look for.

Returns—The model instance. Returns undefined if a model with the specified uid is not found.

Example - find model by uid

<button id="get">Get By UID</button>
<div id="grid"></div>
<div id="result"></div>

  var dataSource = new{
    data: [{ID: 1, Name: "Name 1"}, {ID: 2, Name: "Name 2"}]
    dataSource: dataSource

  $("#get").on("click", function() {
    let secondRow = $("#grid tr:last"),
        uid ="uid");

    // Get the dataItem by using the uid property.
    let dataItem = dataSource.getByUid(uid);

    $("#result").html(`<h4>Result</h4><p>Name - ${dataItem.Name}</p><p>ID - ${dataItem.ID}</p>`);
In this article