0
votes

In my Kendo grid, I've a column (address). Instead of displaying customer's address, it shows a button. On clicking the button, I want to open a Kendo window as a modal and display the address.

...
{ field: "address", 
  title: "Customer Address", 
  width: "130px", 
  filterable: false,
  template: '<span class="viewButton"><input type="button" value="Address" class="k-primary"></input></span>'
},
...

I've tried various strategies, including a custom command, an onClick event handler for the grid etc. But none seems to work. The best I've achieved so far is using custom command, in which I can open the Kendo window, but unable to display the underlying data for the column.

Any ideas for any possible way to achieve this?

1
Yep, I've looked into it. It opens up the window, but for some reason, doesn't pass on the data for me. - SJaka
here is a simplified demo for your scenario: dojo.telerik.com/@ezanker/inUgU - ezanker
@ezanker Thanks. The problem I'm facing with my code is that 'wnd' is not defined, which seems like some kind of scope issue. When I output the value of 'wnd' in an alert box inside showDetails(), it comes up as 'undefined'. - SJaka
I have updated showdetails to not use a global variable: dojo.telerik.com/@ezanker/inUgU - ezanker

1 Answers

0
votes

You can get hold of current dataItem and show it in window.

$("#grid").on("click", ".viewButton",function(e){
  var dataItem = grid.dataSource.dataItem($(e.currentTarget).closest('tr'));
  var yourText = dataItem.address;
});