Created
March 6, 2016 20:09
-
-
Save rmaziarka/fa10d6314a7fc9797c2c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (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 }); | |
| }); | |
| } | |
| } | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
to pass the $event
scope.$eval(attrs.kendoGridRowDblClick, { rowData: rowScope.dataItem, '$event': event });