EasyUI Forum
April 29, 2024, 11:20:32 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: endEdit with blur or keypress?  (Read 18750 times)
pacific202
Newbie
*
Posts: 35


View Profile
« on: October 10, 2011, 08:14:32 PM »

Is there any way to capture a blur event on a datagrid in order to end the edit mode?  I've tried this but the event is not firing:

Code:
$("datagrid-id").blur(function(event){ alert(event); });

I'm trying to call endEdit whenever the user clicks anywhere outside of the cells being edited. 

Even better would be a keypress event that could capture "esc" and "enter", but I haven't figured out how to attach that event either.
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: October 10, 2011, 11:30:59 PM »

The best idea would be to handle the mousedown event:
Code:
$(document).bind('mousedown',function(){
  alert('mousedown');
});
// stop event bubbling on the datagrid panel
$('#datagrid-id').datagrid('getPanel').bind('mousedown',function(){
  return false;
});
Logged
mzeddd
Full Member
***
Posts: 223



View Profile
« Reply #2 on: November 01, 2011, 01:30:13 AM »

Cute solution (treeGrid in my case) Smiley

Code:
onClickRow: function(row){
    $('#tg').treeGrid('beginedit', row.id);
    var timer = setTimeout("$('#tg').treeGrid('endEdit', "+row.id+");",3000);
}

Edit operation will be finished in 3 sec. I have only one checkbox that is why 3 sec. is more than enough for me .
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!