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

Confirmation on row selection change with Kendo for jQuery and AngularJS

1 Answer 87 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ewgenij
Top achievements
Rank 1
Veteran
Ewgenij asked on 29 Jun 2020, 03:33 PM

Hello, I have a similar situation like here Confirmation on row selection, however I work in an AngularJS environment, so I can't work with the suggested solution directly.

$("#Grid tbody").on("mousedown", "tr", function (e) {
    var ok = confirm("Change selection?");
  
    if (ok) {
        $("#Grid").data("kendoGrid").select(this);
    }
});

 

I suppose I need to wrap it into an angular directive somehow?

 

 

 

1 Answer, 1 is accepted

Sort by
0
Accepted
Alex Hajigeorgieva
Telerik team
answered on 01 Jul 2020, 12:12 PM

Hi, Ewgenij,

You can take advantage of the AngularJS syntax for getting the grid instance and the kendoRendered event to attach the mousedown handler:

<div kendo-grid="grid" options="mainGridOptions"></div>

$scope.$on("kendoRendered", function(){
     $scope.grid.element.on("mousedown", "tr", function (e) {
         var ok = confirm("Change selection?");

         if (ok) {
              $scope.grid.select(this);
         }
     });
 });

https://dojo.telerik.com/@bubblemaster/AsUmIvUB/2

Kind Regards,
Alex Hajigeorgieva
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Tags
Grid
Asked by
Ewgenij
Top achievements
Rank 1
Veteran
Answers by
Alex Hajigeorgieva
Telerik team
Share this question
or