EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: yogesh on February 19, 2013, 12:20:51 AM



Title: Access Datagrid/ treegrid rows using keybord
Post by: yogesh 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?


Title: Re: Access Datagrid/ treegrid rows using keybord
Post by: stworthy 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;
}
});


Title: Re: Access Datagrid/ treegrid rows using keybord
Post by: Ellipsis on March 01, 2013, 12:07:18 AM
Can be a nice addition :

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

Great example by the way.


Title: Re: Access Datagrid/ treegrid rows using keybord
Post by: yogesh on March 05, 2013, 02:31:30 AM
Thank you  :)


Title: Re: Access Datagrid/ treegrid rows using keybord
Post by: yogesh 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 ?