How to Get Key ID value

2 posts, 1 answers
  1. Daniel
    Daniel avatar
    36 posts
    Member since:
    Apr 2009

    Posted 07 Sep 2012 Link to this post

    Here below is my code.  How do you get the primay key value.  I can see the correct field in the debugger under
    this._data._key.ID=3 this is correct, I just need some help getting that value.  I have searched the forums but couldn't find a working example


    function BindData (myArray){
             $(document).ready(function() {
                    dataSource: {
                        data: myArray,
                        pageSize: 10
                       change: onChange,
                    selectable: "multiple",
                    navigatable: true,
                    groupable: true,
                    sortable: true,
                    pageable: {
                        refresh: true,
                        pageSizes: true
                    columns: [ {
                        field: "firstname",
                        width: 90,
                        title: "firstname:"
                        field: "lastname",
                        width: 90,
                        title: "lastname:"
           function onChange(arg) {
                        var selected = $.map(, function(item) {
                            return $(item).text();
                      kendoConsole.log("Selected: " + selected.length + " item(s), [" + selected.join(", ") + "]");
  2. Answer
    OnaBai avatar
    55 posts
    Member since:
    Aug 2012

    Posted 07 Sep 2012 Link to this post

    I'm missing some information about your data so I will do some guessing...
    Shall I understand that _key.ID is something particular to your "myArray" DataSource?

    this is your Kendo Grid, so it is the same than saying $("#grid").data("kendoGrid").
    • To get access to the data source you might use: this.dataSource
    • To access the data: and this returns an array of JSON objects.
    • Assuming that _key and ID are part of your JSON data structure (myArray), then you might just access it as[index]._key.ID

Back to Top