Gday,
I've just started playing around with Kendo and I'm trying to enable cell edit on double click in Angularjs.
I have got it working but I am using jquery event handlers and I was wondering whether there was a more 'Angular' way to do it via the templates for eg.
Also I saw some threads where people were using the delegate method - is that a better way to do this do you think?
Thanks,
Will
I've just started playing around with Kendo and I'm trying to enable cell edit on double click in Angularjs.
I have got it working but I am using jquery event handlers and I was wondering whether there was a more 'Angular' way to do it via the templates for eg.
Also I saw some threads where people were using the delegate method - is that a better way to do this do you think?
Thanks,
Will
​var app = angular.module('myApp', ["kendo.directives"]);
app.controller('MyController', function ($scope) {
$scope.gridOptions = {
// standard grid initialisation
}
var grid = $("#grid"); grid.on("dblclick", "tr.k-state-selected td", function () { var $this = $(this); grid.data("kendoGrid").editCell($this); $this.focusout(function(){ // for input elements that use widgets they will lose focus when the widget is rendered
// so we need to rebind the foucsout to the widget var $widget = $('.k-widget', $this); if ($widget.length == 0) { if(!$(".k-grid-edit-row input").hasClass("k-invalid")){ //console.log('focusout'); $("#grid").data("kendoGrid").closeCell(); } }else{ //console.log('widget editing'); $widget.focusout(function() { //console.log('widget focusout'); if(!$(".k-grid-edit-row input").hasClass("k-invalid")) { $("#grid").data("kendoGrid").closeCell(); $widget.off('focusout'); } }); } }); });
}