Heya Telerik,
I've noticed an inconsistency in how row data is passed to the detailInit callback on the grid widget when I'm using the detailTemplate. When the Grid widget is loaded via jquery ($("#grid").kendoGrid()) then the detailInit callback receives a event.data argument that is set to the data for that row, as you would expect. When the Grid widget is loaded via data attributes (data-role="grid") the detailInit callback receives a event.data argument that is set to the dataSource of the entire grid. This means I am unable to access the Id, or any other data for that matter, for the row i'm interested in.
To demonstrate what I'm talking about, here's a JS fiddle. Click on the green block to expand the row: http://jsfiddle.net/ducka/SXcT4/
I've traced the behavior back to the "widget" binder in kendo.binder.js:
I assume this is not correct behavior?
I've noticed an inconsistency in how row data is passed to the detailInit callback on the grid widget when I'm using the detailTemplate. When the Grid widget is loaded via jquery ($("#grid").kendoGrid()) then the detailInit callback receives a event.data argument that is set to the data for that row, as you would expect. When the Grid widget is loaded via data attributes (data-role="grid") the detailInit callback receives a event.data argument that is set to the dataSource of the entire grid. This means I am unable to access the Id, or any other data for that matter, for the row i'm interested in.
To demonstrate what I'm talking about, here's a JS fiddle. Click on the green block to expand the row: http://jsfiddle.net/ducka/SXcT4/
I've traced the behavior back to the "widget" binder in kendo.binder.js:
binders.widget = {
events : Binder.extend({
init:
function
(widget, bindings, options) {
Binder.fn.init.call(
this
, widget.element[0], bindings, options);
this
.widget = widget;
this
.handlers = {};
},
refresh:
function
(key) {
var
binding =
this
.bindings.events[key],
handler =
this
.handlers[key];
if
(handler) {
this
.widget.unbind(key, handler);
}
handler = binding.get();
this
.handlers[key] =
function
(e) {
// >> ISSUE: This line here is overwriting the row data with an instance to the binding source of the grid.
e.data = binding.source;
handler(e);
if
(e.data === binding.source) {
delete
e.data;
}
};
this
.widget.bind(key,
this
.handlers[key]);
},
destroy:
function
() {
var
handler;
for
(handler
in
this
.handlers) {
this
.widget.unbind(handler,
this
.handlers[handler]);
}
}
}),