EasyUI Forum
September 15, 2025, 02:52:50 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: Access Datagrid/ treegrid rows using keybord  (Read 19058 times)
yogesh
Newbie
*
Posts: 47


View Profile Email
« on: February 19, 2013, 12:20:51 AM »

is there support keyboard support in datagrid and treegrid control to select rows and do operation using keyboard?
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: February 19, 2013, 08:56:41 AM »

To select rows by pressing keyboard, you need to extend and implement it yourself. Here is the simple example shows how to navigate rows by pressing up and down key.
Code:
$('#dg').datagrid().datagrid('getPanel').attr('tabindex','-1').bind('keydown',function(e){
switch(e.keyCode){
case 38: // up
var dg = $('#dg');
var row = dg.datagrid('getSelected');
if (row){
var index = dg.datagrid('getRowIndex', row)-1;
if (index>=0){
dg.datagrid('selectRow', index);
}
} else {
var count = dg.datagrid('getRows').length;
if (count>0){
dg.datagrid('selectRow', count-1);
}
}
break;
case 40: // down
//...
break;
}
});
Logged
Ellipsis
Full Member
***
Posts: 113


View Profile WWW
« Reply #2 on: March 01, 2013, 12:07:18 AM »

Can be a nice addition :

jQuery(#).datagrid(...
KeyboardControl: true,
TabIndex: 4,
....:

Great example by the way.
Logged
yogesh
Newbie
*
Posts: 47


View Profile Email
« Reply #3 on: March 05, 2013, 02:31:30 AM »

Thank you  Smiley
Logged
yogesh
Newbie
*
Posts: 47


View Profile Email
« Reply #4 on: March 05, 2013, 02:32:49 AM »

is it possible to add touch screen event on datagrid  row select and right click on row ?

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!