I am using custom commands and trying to get the selected dataitem. I am getting an error inside
the javascript call on this.dataitem
By debugging in chrome i can see that the this.data is not populated on binding directly to a model.
Where as in the telerik examples it is populated.
This is my code:
the javascript call on this.dataitem
By debugging in chrome i can see that the this.data is not populated on binding directly to a model.
Where as in the telerik examples it is populated.
This is my code:
@using Kendo.Mvc.UI @{ var addressList = Model.DataList as List<Intelli.Data.Parties.EFDAL.Entity.GeoAddress>; }<script type="text/javascript"> function viewgeoaddress(e) { //prevent the request which will be made by default e.preventDefault(); //error occurs here!! var dataItem = this.dataItem($(e.currentTarget).closest("tr")); } };</script> @(Html.Kendo().Grid(addressList) .Name("GridPartyGeoAddresses") .Columns(columns => { columns.Bound(p => p.ID).Title("ID").Hidden(true); columns.Bound(p => p.Address).Title("Address").Width(160); columns.Bound(p => p.Region).Title("Region").Width(80); columns.Bound(p => p.Zipcode).Title("Zipcode").Width(80); columns.Command(commands => commands .Custom("btnviewgeoaddress") .Text("View") .Click("viewgeoaddress") .HtmlAttributes(new { style = "text-align: center" })); columns.Command(commands => commands .Custom("btndeletegeoaddress") .Text("Remove") .Click("deletegeoaddress") .HtmlAttributes(new { style = "text-align: center" })); }) .Scrollable(scr => scr.Enabled(true).Height(300)) .Sortable(builder => builder.Enabled(true)) .Resizable(resizing => resizing.Columns(true)) //.Selectable() // .DataSource(dataSource => dataSource // .Ajax() // .ServerOperation(false) // ) )