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

Kendo-authored code sample problem ...

1 Answer 23 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 21 Jan 2016, 07:09 PM

Following link is working  code jsfiddle sample authored (I believe) by one of Kendo own developers

Kendo grid sample

I took the sample in it's entirety and copied it into VS2013 test project.

When I run it: grid shows up correctly, exactly like in jsfiddle sample, when I select grid row event "on change" is firing correctly as well.

But in "change" event in my version variable id is "undefined"! 

I can't figure out what's wrong and will appreciate any help or advise. Thanks!

change: function () {
     var row = this.select(); // this variable is (context: undefined, length: 1, selector:">tbody>tr.k-state-selected, "
    var id = row.data("id"); // id is undefined in my copy but works in jsfiddle!
 
     $("#log").html("selected row with id= " + id + " , for ShipName = " + dataSource.get(id).get("ShipName"));
}

My<script> and <style> tags:

link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.1/themes/smoothness/jquery-ui.css" />
    <link href="./js/kendopro/styles/kendo.common.min.css" rel="stylesheet" />
    <link href="./js/kendopro/styles/kendo.default.min.css" rel="stylesheet" />
    <link href="./js/kendopro/styles/kendo.silver.min.css" rel="stylesheet" />

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
    <script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.1/jquery-ui.min.js"></script>
    <script src="./js/kendopro/js/kendo.all.min.js"></script>

 

1 Answer, 1 is accepted

Sort by
0
Venelin
Telerik team
answered on 25 Jan 2016, 11:46 AM
Hello Michael,

This is because the JS Fiddle code you mentioned reference a version of kendo that is very old (2011). Now grid rows don't have data-id, but data-uid instead. Use row.data("uid") to retrieve the unique identifier.

Regards,
Venelin
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
Michael
Top achievements
Rank 1
Answers by
Venelin
Telerik team
Share this question
or