easyui datagrid 跨页选择
$.fn.extend( memberList ,{
quickSearch : function() {
var time1 = new Date();
/* this.datagrid.datagrid('clearSelections'); */
if(this.advSearchForm) {
this.searchForm.setBaseConditions(this.advSearchForm.getConditions());
}
if( this.beforeSearch(this.searchForm.getQo()) ){
/* this.datagrid.datagrid('clearSelections'); */
this.datagrid.datagrid('load', {
searchConditions : JSON.stringify(this.searchForm.getQo()),
sort : this.sortFields,
order : this.sortRules
});
//initFooter(this,config);
}
var time2 = new Date();
}
});
具体代码:
$("#maingrid").datagrid({
onSelect:function(index,row){
addItem(row.memberId);
},
onUnselect:function(index,row){
removeItem(row.memberId)
},
onSelectAll:function(rows){
addAll(rows);
},
onUnselectAll:function(rows){
removeAll(rows);
},
onLoadSuccess: function(){
if(!ids){
return;
}
var myrows = $('#maingrid').datagrid('getRows');
for(var i=0; i<myrows.length; i++){
for(var j=0; j<ids.length; j++){
if(myrows[i].memberId == ids[j]){
var index = $('#maingrid').datagrid('getRowIndex',myrows[i]);
$('#maingrid').datagrid('selectRow',index);
}
}
}
}
});
function addItem(assetsId){
var arrs = ids.join();
console.info("arrs="+arrs);
if(arrs.indexOf(assetsId) == -1){
ids.push(assetsId);
}
console.info("ids="+ids);
}
//add current page
function addAll(rows){
for(var i=0; i<rows.length; i++){
var arrs = ids.join();
if(arrs.indexOf(rows[i].assetsId) == -1){
ids.push(rows[i].assetsId);
}
}
console.info("addAll-ids="+ids);
}
//remove unSelect
function removeItem(assetsId){
var arrs = ids.join();
console.info("arrs="+arrs);
var indexTmp = arrs.indexOf(assetsId);
console.info("index="+indexTmp);
if(indexTmp != -1){
for(var i=0; i<ids.length; i++){
if(ids[i] == assetsId){
ids.splice(i,1);
}
}
}
console.info("ids="+ids);
}
//remove current page
function removeAll(rows){
for(var i=0; i<rows.length; i++){
var arrs = ids.join();
var indexTmp = arrs.indexOf(rows[i].assetsId);
if(indexTmp != -1){
for(var j=0; j<ids.length; j++){
if(ids[j] == rows[i].assetsId){
ids.splice(j,1);
}
}
}
}
console.info("removeAll-ids="+ids);
}
$("#btn_ok").click(
function(){
var ids = [];
var names=[];
var rows = $('#maingrid').datagrid('getSelections');
for(var i=0; i<rows.length; i++){
ids.push(rows[i].memberId);
names.push(rows[i].trueName);
}
$("#recList").val(ids.join());
$("#member_win").dialog("close");
$("#recListName").textbox("setValue",names.join());
});
easyui datagrid 跨页选择的更多相关文章
- jquery easyui datagrid 获取Checked选择行(勾选行)数据
原文:jquery easyui datagrid 获取Checked选择行(勾选行)数据 getSelected:取得第一个选中行数据,如果没有选中行,则返回 null,否则返回记录. getSel ...
- jquery easyui datagrid翻页后再查询始终从第一页开始
在查询之前将datagrid的属性pageNumber重新设置为1 var opts = grid.datagrid('options'); opts.pageNumber = 1; easyui d ...
- easyui DataGrid 的 Checkbox 选择多行
这么一来在取得 DataGrid 的 Checkbox 有勾选的数据值就可以沿用方式一的程序, 1.$('#ButonGetCheck').click(function(){ 2.var checke ...
- easyui datagrid footer 页脚问题
mvc 的一个例子 public string IndexV2() { var dataGridJson = new DataGridJson(); var data = new List<My ...
- jqGrid 跨页选择以及回显的处理
思路:定义全局的array(selectedIds),当列表选中的时候就push进去,当列表取消选中时,将该项从selectedIds中删除 重点:1.列表加载完成时为列表增加复选框,并给每一个che ...
- easyui datagrid 选中行效果
转:http://blog.csdn.net/hzw2312/article/details/27534065 jquery easyui datagrid 获取Checked选择行(勾选行)数据 g ...
- easyui datagrid单击单元格选择此列
示例代码实现单击jquery easyui datagrid的单元格时,取消datagrid默认选中高亮此行的样式,改为选中单击的单元格所在的列,高亮此列上的所有单元格.可以配置全局single变量, ...
- jquery easyui datagrid 加每页合计和总合计
jquery easyui datagrid 加每页合计和总合计 一:效果图 二:代码实现 这个只有从后台来处理 后台根据rows 和page两个参数返回的datatable 命名为dt 然后根据dt ...
- layui table 跨页记忆选择
layui 表格功能目前默认不支持跨页记忆选择 下面来实现layui table跨页记忆选择实现 基于layui版本 1.4.5 表格跨页通用方法 //表格分页复选框 layui.define(['j ...
随机推荐
- c/c++ 函数指针 指针函数 数组的引用 指针数组 数组指针
1.指针数组数组指针 引用数组 数组的引用 int *a[10] 指针数组 每一个元素都是一个指针 Int (*a)[10] 数组指针 P指向一个含有10个元素的数组 Int (&a)[10] ...
- 从零开始学习Node.js例子四 多页面实现数学运算
app-node.js ; var http = require('http'); var htutil = require('./htutil'); var server = http.create ...
- JavaScript作用域学习笔记
重点知识点摘要 一 函数对象和其它对象一样,拥有可以通过代码访问的属性和一系列仅供JavaScript引擎访问的内部属性 其中一个内部属性是[[Scope]],由ECMA-262标准第三版定义,该内部 ...
- Conntect Bluetooth devices in iOS.
I understand that the External Accessory framework in iOS 3.0 and later will allow my application to ...
- BlackJack Strategy
GAME SPEC: 2-deck, 104 cards total. Bellagio has 2-deck and 6-deck games. based on hard 17, dealer h ...
- sscanf格式化输出
char DesChar[20] = {0}; char* SouChar= "1cZCD23456abEFdedfB"; sscanf(SouChar,"%[^A-Z] ...
- HTML标签小记
<body> </body>标签,网页内容放在这里 <p> </p>标签,网页的段落 <hx> </hx>标签,网页的标题 &l ...
- QQ空间漫步者
主要功能(QQ空间) 判断空间权限并跳过无法访问 留下足迹并可选:同时留言(可单独),赞主页(可单独),赞说说(可单独) 其他附加功能,导出QQ,导入群成员,好友,空间访客,说说评论,发表说说 送空间 ...
- windows ftp 连接serv_U 管理员
连接工具名称:8uftp 小技巧:活动模式连接
- 为重负网络优化 Nginx 和 Node.js --引用自https://linux.cn/article-1314-1.html
为重负网络优化 Nginx 和 Node.js 在搭建高吞吐量web应用这个议题上,NginX和Node.js可谓是天生一对.他们都是基于事件驱动模型而设计,可以轻易突破Apache等传统web服务器 ...