<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>IndexV6</title> <link href="/Plugs/jquery-easyui-1.4.3/themes/default/easyui.css" rel="stylesheet" />
<link href="/Plugs/jquery-easyui-1.4.3/themes/icon.css" rel="stylesheet" />
<script src="/Plugs/jquery-easyui-1.4.3/jquery.min-1.11.3.js"></script> <script src="/Plugs/jquery-easyui-1.4.3/jquery.easyui.min-1.4.3.js"></script> <script src="/Plugs/jquery-easyui-1.4.3/locale/easyui-lang-zh_CN-1.0.js"></script>
<script src="/Plugs/jquery-easyui-1.4.3/pengbg/pengbgEasyuiControl.js"></script>
</head>
<body> <h2>IndexV6</h2>
<table class="easyui-datagrid" title="" style="width: 408px"
data-options="url:'/Test/Data',onClickRow:fun,
singleSelect: true,
" id="datagrid">
<thead>
<tr>
<th data-options="field:'ck',checkbox: 'true'"></th>
<th data-options="field:'UpdateUser'"></th>
</tr>
</thead>
</table> <script>
$(document).ready(function () {
$("body")[].onkeydown = keyPress;
$("body")[].onkeyup = keyRelease;
});
function fun(index, row) {
if (index != selectIndexs.firstSelectRowIndex && !inputFlags.isShiftDown) {
selectIndexs.firstSelectRowIndex = index; //alert('firstSelectRowIndex, sfhit = ' + index);
}
if (inputFlags.isShiftDown) {
$('#datagrid').datagrid('clearSelections');
selectIndexs.lastSelectRowIndex = index;
var tempIndex = ;
if (selectIndexs.firstSelectRowIndex > selectIndexs.lastSelectRowIndex) {
tempIndex = selectIndexs.firstSelectRowIndex;
selectIndexs.firstSelectRowIndex = selectIndexs.lastSelectRowIndex;
selectIndexs.lastSelectRowIndex = tempIndex;
}
for (var i = selectIndexs.firstSelectRowIndex ; i <= selectIndexs.lastSelectRowIndex ; i++) {
$('#datagrid').datagrid('selectRow', i);
}
}
}
var KEY = { SHIFT: , CTRL: , ALT: , DOWN: , RIGHT: , UP: , LEFT: };
var selectIndexs = { firstSelectRowIndex: , lastSelectRowIndex: };
var inputFlags = { isShiftDown: false, isCtrlDown: false, isAltDown: false }; function keyPress(event) {//响应键盘按下事件
var e = event || window.event;
var code = e.keyCode | e.which | e.charCode;
switch (code) {
case KEY.SHIFT:
inputFlags.isShiftDown = true;
$('#datagrid').datagrid('options').singleSelect = false;
break;
case KEY.CTRL:
inputFlags.isCtrlDown = true;
$('#datagrid').datagrid('options').singleSelect = false;
break;
default:
}
} function keyRelease(event) { //响应键盘按键放开的事件
var e = event || window.event;
var code = e.keyCode | e.which | e.charCode;
switch (code) {
case KEY.SHIFT:
inputFlags.isShiftDown = false;
selectIndexs.firstSelectRowIndex = ;
$('#datagrid').datagrid('options').singleSelect = true;
break;
case KEY.CTRL:
inputFlags.isCtrlDown = false;
selectIndexs.firstSelectRowIndex = ;
$('#datagrid').datagrid('options').singleSelect = true;
break;
default:
}
}
</script> </body>
</html>

easyui datagrid shift 多选的更多相关文章

  1. EasyUI datagrid默认勾选checkbox时注意事项

    在使用easyui的datagrid默认选中复选框时遇到的一个问题:就是加载程序默认选中复选框时死活选不中,查了好多资料才知道是easyui的datagrid的singleSelect属性设置为‘tr ...

  2. easyui datagrid 通过复选框删除新追加的数据问题

    之前写好的功能在保存好数据后再通过复选框删除是没有问题的,可现在想多追加几行,然后选择删除新追加的某几行或一行,通过$('#dg').datagrid('getChecked')方法返回选中行,然而返 ...

  3. easyui datagrid checkbox复选框取消单击选中事件、初始全选全不选等问题解决

    系统业务需要,导入的列表数据默认全部选中,且不可取消选中行.全部店铺优惠券发放过后导入的数据全部清空.如图所示: 一.初始化页面默认全部选中“selectAll”,全部不选中“unselectAll” ...

  4. easyui datagrid去掉全选按钮

    第一步: F12查看元素,选中全选按钮,把全选按钮的class里边加上display:none属性.找到对应的class,即.datagrid-header-check. 第二步: 在加载 表格的时候 ...

  5. EasyUI DataGrid Checkbox 多选 获取选中行中的内容

    <table id='grid' class='easyui-datagrid' style='width:950px;height:405px' url='Ajax-index.php?mod ...

  6. EasyUI DataGrid 根据ID选中行(转载)

      转载来源: https://blog.csdn.net/chq00788/article/details/51505519 function selectRows(){ //获取需要选中的记录ID ...

  7. easyui datagrid 去掉 全选checkbox

    在加载 表格的时候添加事件:onLoadSuccess 在事件中写入下面句,用空代替原有HTML 达到取消效果. $(".datagrid-header-check").html( ...

  8. Easyui datagrid 隐藏多选框 checkbox

    在加载 表格的时候添加事件:onLoadSuccess 在事件中写入下面句,用空代替原有HTML 达到取消效果. $(".datagrid-header-check").html( ...

  9. EasyUI DataGrid单选如何取消选中

    EasyUI DataGrid在多选时,选中某行,可以取消:而在单选时,并不能取消选中某一行. 可以通过修改源码来完成. 在其源码中找到 opts.singleSelect==true 将代码做如下修 ...

随机推荐

  1. 纯 Swift 封装的 SQLite 框架:SQLite.swift

    SQLite.swift 是一个使用纯 Swift 语言封装 SQLite3 的操作框架. 特性: 简单的查询和参数绑定接口 安全.自动类型数据访问 隐式提交和回滚接口 开发者友好的错误处理和调试 文 ...

  2. crm操作观点

    using System;     using Microsoft.Xrm.Sdk;     using Microsoft.Crm.Sdk.Messages; /// <summary> ...

  3. jxl创Excel档java示例代码说明

    记得下载 并 导入jxl.jar 包,免积分下载地址:http://download.csdn.net/detail/u010011052/7561041 package Test; import j ...

  4. Java 内存架构

    a)        执行. main()作为该程序的初始线的起点.无论由线程开始在其他线程. JVM有两个内螺纹:守护线程和非守护线程,main()它是一个非守护线程.常由JVM自己使用.java程序 ...

  5. 跨域请求jQuery的ajax jsonp使用常见问题解答

    前天在项目中写了ajax jsonp的使用,出现了问题:能够成功获得请求结果,但没有运行success方法,直接运行了error方法提示错误--ajax jsonp之前并没实用过.对其的理解为跟普通的 ...

  6. head first c&lt;11&gt;在根据网络编程

    博文可以在一个大的网络通信实现,但是,一个人只能起到,我们能够给每个clientfork()子进程,实现诸多的服务. 方法: client连到server以后,server启动一个新创建的套接字对话. ...

  7. Dom7.js 源码阅读备份

    在Framework7,其特色的HTML框架,可以创建精美的iOS应用;  她有自己的 DOM7- 一个集成了大部分常用DOM操作的高性能库.你不需要学习任何新的东西,因为她的用法和大名鼎鼎的jQue ...

  8. bcp sqlcmd bulkinsert在unicode问题,Unexpected EOF encountered in BCP data-file

    senario 进入sqlcmd使用:out xxx产生的数据文件,因为sqlcmd export to file 默认情况下,中国的乱码.因此,使用-u(unicode)开关 @echo off & ...

  9. SWTBOK实践测试系列(2) --您将提交测试开发者版本号打回来了?

    开发商斗争非常多晚,提交测试的最终版本. 它们可以缓和.但噩耗传来很快,软件没有通过预测试测试团队(为了确保在测试过程,开发者提交的代码验证的基本功能或业务流程).开发王经理.快速找到负责预测试试验张 ...

  10. Redis相关命令及Jedis的demo(转)

    org.springframework.data.redis.core.RedisTemplate在List操作时的一个注意事项:BoundListOperations boundListOperat ...