Skip to content

Instantly share code, notes, and snippets.

@rmaziarka
Created March 6, 2016 20:09
Show Gist options
  • Select an option

  • Save rmaziarka/fa10d6314a7fc9797c2c to your computer and use it in GitHub Desktop.

Select an option

Save rmaziarka/fa10d6314a7fc9797c2c to your computer and use it in GitHub Desktop.
(function () {
angular.module('moduleName').directive('kendoGridRowDblClick', kendoGridRowDblClick);
function kendoGridRowDblClick() {
return {
link: function (scope, element, attrs) {
scope.$on("kendoWidgetCreated", function (event, widget) {
if (widget !== element.getKendoGrid())
return;
attachDblClickToRows(scope, element, attrs);
element.data("kendoGrid").bind('dataBound', function () {
attachDblClickToRows(scope, element, attrs);
});
});
}
};
function attachDblClickToRows(scope, element, attrs) {
element.find('tbody tr').on('dblclick', function (event) {
var rowScope = angular.element(event.currentTarget).scope();
scope.$eval(attrs.kendoGridRowDblClick, { rowData: rowScope.dataItem });
});
}
}
})();
@alenteria
Copy link

to pass the $event
scope.$eval(attrs.kendoGridRowDblClick, { rowData: rowScope.dataItem, '$event': event });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment