EasyUI Forum
October 16, 2024, 01:20:25 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: As I can use the up, down, left or to right in a datagrid?  (Read 28358 times)
bvicencio
Newbie
*
Posts: 13


View Profile Email
« on: July 03, 2012, 08:22:42 AM »

As I can use the up, down, left or to right in a datagrid?

Gracias por su ayuda
« Last Edit: July 09, 2012, 06:56:48 AM by bvicencio » Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: July 06, 2012, 06:48:09 AM »

Bind 'keydown' event for datagrid outer panel:
Code:
$('#test').datagrid('getPanel').panel('panel').attr('tabindex',1).bind('keydown',function(e){
switch(e.keyCode){
case 38: // up
var selected = $('#test').datagrid('getSelected');
if (selected){
var index = $('#test').datagrid('getRowIndex', selected);
$('#test').datagrid('selectRow', index-1);
} else {
$('#test').datagrid('selectRow', 0);
}
break;
case 40: // down
var selected = $('#test').datagrid('getSelected');
if (selected){
var index = $('#test').datagrid('getRowIndex', selected);
$('#test').datagrid('selectRow', index+1);
} else {
$('#test').datagrid('selectRow', 0);
}
break;
}
});
Logged
bvicencio
Newbie
*
Posts: 13


View Profile Email
« Reply #2 on: July 09, 2012, 02:06:14 PM »

Great!!... Thank you very much. It's usefull
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!