need to know whether Grid is in edit mode or not

3 posts, 0 answers
  1. Brian
    Brian avatar
    10 posts
    Member since:
    Jun 2011

    Posted 26 Dec 2013 Link to this post

    I have a "click" behavior on one of the grid cells ( ex:  $(grid.tbody).on("click", "td", function (e) {...});  ), however, I need it to behave differently if I am in edit mode.  I know that I can attach to the "edit" event to determine when edit mode is entered, but need to reliably know that we are NOT in edit mode - regardless of whether user clicked "Update" or "Cancel".

    I tried detecting click event for all three buttons (Edit, Update, Cancel) by their class, but the class selector did not seem to bind correctly.

    I'm not aware of any grid property like  " isInEditMode".

    What option(s) do I have?

    Thanks much,
    R
  2. Alexander Popov
    Admin
    Alexander Popov avatar
    1416 posts

    Posted 26 Dec 2013 Link to this post

    Hi Rich,

    There is no method providing such information, however rows that are being edited have "k-grid-edit-row" class, so you can check for that. For example:  
    $(grid.tbody).on("click", "td", function (e) {
      if($(this).closest("tr").hasClass("k-grid-edit-row")){
         alert("editing");
      }else{
         alert("not editing");
      }
    });


    Regards,
    Alexander Popov
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Kendo UI is VS 2017 Ready
  4. Brian
    Brian avatar
    10 posts
    Member since:
    Jun 2011

    Posted 26 Dec 2013 Link to this post

    Perfect!  This accomplishes just what I need.

    Thanks much for the quick reply,
    R
Back to Top