扩 확장datagrid의 一个방법keyCtr
$.extend($. fn.datagrid.methods, {
keyCtr : function (jq) {
return jq.each(function () {
vargrid = $(this);
grid.datagrid('getPanel' ).panel('panel').attr('tabindex', 1).bind('keydown', function (e) {
switch (e.keyCode) {
case 38: // up
var selected = Grid.datagrid('getSelected');
if (선택됨) {
var index = Grid.datagrid('getRowIndex', selected)
grid.datagrid('selectRow', index - 1);
} else {
varrows = Grid.datagrid('getRows')
grid.datagrid('selectRow',rows.length - 1); break;
case 40: // 아래
var selected = Grid.datagrid('getSelected');
if (selected) {
var index = Grid.datagrid('getRowIndex', selected) ;
grid.datagrid('selectRow', index 1);
} else {
grid.datagrid('selectRow', 0)
}
break; 🎜>});
})
}
});