0
votes

I'm able to get the selected row in kendo grid, But I'm unable to get the specific selected row data in detail grid.

enter image description here

One thing that I expect is just get the Ticket_ID field string "5d484b061bf03".

I've tried to make my code just like this:

function onChange(arg) {
       var selected = $.map(this.select(), function(item) {
            return $(item).text();
       });
       myWindow.data("kendoWindow").open();
       undo.fadeOut();
       console.log(selected.TICKET_ID);
}

But just getting "undefined".

Any well thought to advise will be appreciated.

Thanks

1
Add more of your grid's code. Its hard to guess the issue with so little piece of code. I'm not sure what is onChange, or this.select(). You say detail grid but I can see a detail grid in the screen shot. Also the object printed in the console is very wierd. It seems that all columns values are concatenated. - DontVoteMeDown

1 Answers

0
votes

jQuery $.map returns an array constructed of return values, and you are returning strings.

See Telerik example in API reference for kendo.ui.Grid change to see more about getting the data items used to construct the selected grid rows. The data items will have a field corresponding to the ticket_id value. The name of the field is case-sensitive.

change: function(e) {
  var selectedRows = this.select();
  var selectedDataItems = [];
  for (var i = 0; i < selectedRows.length; i++) {
    var dataItem = this.dataItem(selectedRows[i]);

    console.log (dataItem);

    selectedDataItems.push(dataItem);
  }
  // selectedDataItems contains all selected data items
}