$.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 跨页选择的更多相关文章

  1. jquery easyui datagrid 获取Checked选择行(勾选行)数据

    原文:jquery easyui datagrid 获取Checked选择行(勾选行)数据 getSelected:取得第一个选中行数据,如果没有选中行,则返回 null,否则返回记录. getSel ...

  2. jquery easyui datagrid翻页后再查询始终从第一页开始

    在查询之前将datagrid的属性pageNumber重新设置为1 var opts = grid.datagrid('options'); opts.pageNumber = 1; easyui d ...

  3. easyui DataGrid 的 Checkbox 选择多行

    这么一来在取得 DataGrid 的 Checkbox 有勾选的数据值就可以沿用方式一的程序, 1.$('#ButonGetCheck').click(function(){ 2.var checke ...

  4. easyui datagrid footer 页脚问题

    mvc 的一个例子 public string IndexV2() { var dataGridJson = new DataGridJson(); var data = new List<My ...

  5. jqGrid 跨页选择以及回显的处理

    思路:定义全局的array(selectedIds),当列表选中的时候就push进去,当列表取消选中时,将该项从selectedIds中删除 重点:1.列表加载完成时为列表增加复选框,并给每一个che ...

  6. easyui datagrid 选中行效果

    转:http://blog.csdn.net/hzw2312/article/details/27534065 jquery easyui datagrid 获取Checked选择行(勾选行)数据 g ...

  7. easyui datagrid单击单元格选择此列

    示例代码实现单击jquery easyui datagrid的单元格时,取消datagrid默认选中高亮此行的样式,改为选中单击的单元格所在的列,高亮此列上的所有单元格.可以配置全局single变量, ...

  8. jquery easyui datagrid 加每页合计和总合计

    jquery easyui datagrid 加每页合计和总合计 一:效果图 二:代码实现 这个只有从后台来处理 后台根据rows 和page两个参数返回的datatable 命名为dt 然后根据dt ...

  9. layui table 跨页记忆选择

    layui 表格功能目前默认不支持跨页记忆选择 下面来实现layui table跨页记忆选择实现 基于layui版本 1.4.5 表格跨页通用方法 //表格分页复选框 layui.define(['j ...

随机推荐

  1. HDU 2089 不要62

    也是简单的数位dp. #include<iostream> #include<cstdio> #include<cstring> #include<algor ...

  2. GCD线程间通信

    从子线程回到主线程 dispatch_async( dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{     // 执 ...

  3. oop、try_except、单例模式

    本节大纲: 面向对象特性:封装.继承.多态.一:多态:python本身是多态,他的参数可以多种类型.可以是字符串.数字.列表等.当传入参数的时候,python可以判断参数的数据类型.而在java C# ...

  4. C++模板中的函数对象

    在C++模板类map中一个参数为Compare类型,该类型为一个比较函数,其完整定义如下: template< class Key, class T, class Compare = std:: ...

  5. Welcome to LED Control Wiki

    About this project This project was developed after I had to find out that controlling my RGB ambien ...

  6. jq 一些小方法

    js 控制a标签的onclick方法 document.getElementById("a3").onclick = ""; window.document.g ...

  7. jquery dataTables.min.js API

    demo: http://datatables.net/release-datatables/examples/api/select_single_row.html 选择一行http://datata ...

  8. [poj 1502]昂贵的聘礼

    一道不算太难的最短路喵~ 容我吐槽一下,酋长的地位居然不是最高的额——那你特么的居然还算是酋长?! 枚举一个地位区间 [i..i+M-1] 只要所有的交易者的地位都在该区间中,那么就不会引起冲突 而这 ...

  9. 在Windows上,迁移VisualSVN server

    最近在搭建自动化测试框架,顺便了解了一下SVN的搭建.对于一般的使用场景,VisualSVN还是挺方便的,而且上手特别快. 由于是第一个demo,后期要迁移到其他服务器上面,所以就熟悉了一下serve ...

  10. 使用pt-stalk分析MySQL的性能波动 (转)

    简介 在MySQL服务器出现短暂(5~30秒)的性能波动的时候,一般的性能监控工具都很难抓住故障现场,也就很难收集对应较细粒度的诊断信息.另外,如果这种波动出现的频率很低,例如几天才一次,我们也很难人 ...