timeArray = new Array();    //临时数组变量
var timeStatusBar = new Ext.ux.StatusBar({
id: 'statusbar',
defaultText: '选择时间列表',
});
var timeSelectModel = new Ext.grid.CheckboxSelectionModel({
checkOnly:true,
singleSelect:false,
listeners:{
rowselect:function(sm, rowIndex, record){ //选择事件,将time添加到timeArray中
var time = record.data.time;
if (!ArrayContains(timeArray, time)){
//timeArray中没有存储time,则添加到timeArray中
var link = '<a href="javascript:removeTime_result('+time+')"><img src="/NetMonitor/Images/common/delete.gif"/></a>';
ArrayAppendDesc(timeArray, time, [time, link]);
timeStore_result.loadData(timeArray);
} },
rowdeselect:function(sm, rowIndex, record){ //取消选择事件,从timeArray中移除出去
//临时变量中存储了这个time,则从timeArray中移除出去
var time = record.data.time;
ArrayRemove(timeArray, time);
timeStore_result.loadData(timeArray);
}
}
});
var timeColumnModel = new Ext.grid.ColumnModel([
{ header:'时间选择列表',dataIndex:'time',width:200,align:'center'},
timeSelectModel
]);
var timeRecordType = Ext.data.Record.create([{name:'time'}]);
var timeStore = new Ext.data.Store({
id:'timeStore',
proxy:new Ext.data.DWRProxy(ExcelDaoService.getGridTime_ExcelDao,false),
reader:new Ext.data.ListRangeReader({
root:'data',
totalProperty:'totalSize'
},timeRecordType)
,
listeners:{
beforeload:function(){
timeStore.baseParams = {table:table};
},
load:function(){ //加载的时候,根据临时变量timeArray勾选
var records = new Array();
timeStore.each(function(record){
for(var i=0; i<timeArray.length; i++){
if(timeArray[i][0] == record.data.time){
records.push(record);
}
}
});
timeSelectModel.selectRecords(records, true);
}
},
remoteSort:true
}); var pageTBar=new Ext.PagingToolbar({
id:'pagingTbr',
pageSize: 20,
store:timeStore,
afterPageText:'共{0}页',
beforePageText:"当前页",
lastText:"尾页",
nextText:"下一页",
prevText:"上一页",
firstText:"首页"
});
var timeGrid = new Ext.grid.GridPanel({
id:'timeGrid',
tbar:timeStatusBar,
bbar:pageTBar,
cm:timeColumnModel,
sm:timeSelectModel,
store:timeStore,
autoScroll:true,
stripeRows:true,
height:540
});

Ext grid checkbox在翻页的过程中,会碰到之前勾选的数据,无法记录的情况,这时就应该使用一个临时array变量存储勾选的值,然后在grid每次load的时候,把每行数据与该array变量进行遍历判断,这样就能实现翻页保持勾选数据的效果。

Ext grid checkbox 分页 翻页 勾选 问题的更多相关文章

  1. 织梦DEDECMS网站首页如何实现分页翻页

    织梦DEDECMS模板网站首页如何实现首页分页和翻页 方法如下:(三种方法,自己选择一种来实现分页吧) 第一种:调用ajax和参数的(不推荐)1.必须在DEDE首页模板中的<head>&l ...

  2. jqgrid 翻页记录选中行

    简单的jqgrid列表 $("#list").jqGrid({ url:contextPath + "/getList", postData: data, da ...

  3. 【extjs】 ext5 Ext.grid.Panel 分页,搜索

    带有分页,搜索的grid. <%@page language="java" contentType="text/html; charset=UTF-8" ...

  4. Ext.grid.EditorGridPanel分页和查看全部

    在gridPanel添加查看全部数据按钮,必须使得每页显示的数量pageSize为总条数,那么总页数就只会有一页. 1.获取store数据的总条数 var totalCount = grid.getS ...

  5. [Extjs] Ext4 Ext.grid.Panel 分页实现(mybatis 分页插件-PageHelper 使用)

    先看图: 页面js代码: var userStore=Ext.create('Ext.data.Store', { storeId:'userStore', fields:['uname', 'ema ...

  6. Element UI表格组件技巧:如何简洁实现跨页勾选、跨页统计功能

    业务场景 在使用Element UI的Table组件时,常常面对这样的业务需求: 表格数据的每一项都要提供勾选框,当切换分页时,能够记忆所有页面勾选的数据,以实现批量提交不同页面勾选数据的功能.并且, ...

  7. layui table 分页 记住之前勾选的数据

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  8. Dynamics CRM2013 sub grid中数据翻页问题

    CRM2013中一个很低级很令人无语的BUG,见下图subgrid中的明细条目超过当前页设置的条目后会有翻页,在底下有个paging bar会显示条数.页数.当前所处页数 但sp1版本的CRM打上ur ...

  9. easyui grid中翻页多选方法

    <table class="easyui-datagrid" title="人员选择" id="dg" data-options=&q ...

随机推荐

  1. AS3 求两条直线的交点

    //粘贴到帧上运行即可 var p1Start:Point = new Point(0,0); var p1End:Point = new Point(50,50); var p2Start:Poin ...

  2. [转]使用onclick跳转到其他页面/跳转到指定url

    如果是本页显示可以直接用location,方法如下: ①onclick="javascript:window.location.href='URL'" ②onclick=" ...

  3. jQuery mobile 前台设计中的css em的使用。

    先贴个网址:http://www.uml.org.cn/html/201207311.asp 大家可以参考一下面这张转换表(body字体为16px时的值) 总结 长篇介绍了一大堆,唯一想告诉大家的是以 ...

  4. read 读取文件内容

    文件名 test28.sh #!/bin bash # reading data from a file count= cat test | while read line do echo " ...

  5. 百度之星Astar2016 Round2A

    All X 等比数列求和一下 A/B MOD C = A MOD (B*C) / B  或者分治一下 Sitting in Line 状压+拓扑dp dp(i, j)表示当前二进制状态为j,当前状态的 ...

  6. 教你如何精通Struts:Tiles框架

    Tiles框架特性和内容 Tiles框架为创建Web页面提供了一种模板机制,它能将网页的布局和内容分离.它允许先创建模板,然后在运行时动态地将内容插入到模板中.Tiles 框架建立在JSP的inclu ...

  7. C++时间函数模板

    //测时间 class Timer { private: clock_t _start; clock_t _end; public: Timer() { start(); } void start() ...

  8. tomcat字符,文档,数据库配置

    修改tomcat目录下conf目录下的server.xml tomcat容器的解码配置 URIEncoding="UTF-8" <Connector port="8 ...

  9. Mvc4_Area的应用

    为什么需要分离? 我们知道MVC项目各部分职责比较清晰,相比较ASP.NET Webform而言,MVC项目的业务逻辑和页面展现较好地分离开来,这样的做法有许多优点,比如可测试,易扩展等等.但是在实际 ...

  10. 转载 uboot 命令

    1.bootm bootm [addr [arg ...]] - boot application image stored in memory passing arguments 'arg ...' ...