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

need to know whether Grid is in edit mode or not

2 Answers 922 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Brian
Top achievements
Rank 1
Brian asked on 26 Dec 2013, 02:17 PM
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 Answers, 1 is accepted

Sort by
0
Alexander Popov
Telerik team
answered on 26 Dec 2013, 02:43 PM
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!
0
Brian
Top achievements
Rank 1
answered on 26 Dec 2013, 06:32 PM
Perfect!  This accomplishes just what I need.

Thanks much for the quick reply,
R
Tags
Grid
Asked by
Brian
Top achievements
Rank 1
Answers by
Alexander Popov
Telerik team
Brian
Top achievements
Rank 1
Share this question
or