Confirmation on row selection change with Kendo for jQuery and AngularJS

2 posts, 1 answers
  1. Ewgenij
    Ewgenij avatar
    15 posts
    Member since:
    Jun 2020

    Posted 29 Jun 2020 Link to this post

    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?

     

     

     

  2. Answer
    Alex Hajigeorgieva
    Admin
    Alex Hajigeorgieva avatar
    1082 posts

    Posted 01 Jul 2020 Link to this post

    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.
Back to Top