This is a migrated thread and some comments may be shown as answers.

[Solved] Double click cell edit in angularjs

1 Answer 314 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Willem
Top achievements
Rank 1
Willem asked on 09 Sep 2014, 02:17 AM
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

​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');
                 }
             });
         }
 
     });
 });
}

1 Answer, 1 is accepted

Sort by
0
Alexander Valchev
Telerik team
answered on 10 Sep 2014, 02:46 PM
Hello Willem,

The requested functionality is not supported out of the box - by design, in in-cell editing mode, the cells are opened for edit on single click. If you would like to change the default behaviour you may use the editCell method like in the example you provided. 

Regards,
Alexander Valchev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
Willem
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
Share this question
or