Ext grid checkbox 分页 翻页 勾选 问题
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 分页 翻页 勾选 问题的更多相关文章
- 织梦DEDECMS网站首页如何实现分页翻页
织梦DEDECMS模板网站首页如何实现首页分页和翻页 方法如下:(三种方法,自己选择一种来实现分页吧) 第一种:调用ajax和参数的(不推荐)1.必须在DEDE首页模板中的<head>&l ...
- jqgrid 翻页记录选中行
简单的jqgrid列表 $("#list").jqGrid({ url:contextPath + "/getList", postData: data, da ...
- 【extjs】 ext5 Ext.grid.Panel 分页,搜索
带有分页,搜索的grid. <%@page language="java" contentType="text/html; charset=UTF-8" ...
- Ext.grid.EditorGridPanel分页和查看全部
在gridPanel添加查看全部数据按钮,必须使得每页显示的数量pageSize为总条数,那么总页数就只会有一页. 1.获取store数据的总条数 var totalCount = grid.getS ...
- [Extjs] Ext4 Ext.grid.Panel 分页实现(mybatis 分页插件-PageHelper 使用)
先看图: 页面js代码: var userStore=Ext.create('Ext.data.Store', { storeId:'userStore', fields:['uname', 'ema ...
- Element UI表格组件技巧:如何简洁实现跨页勾选、跨页统计功能
业务场景 在使用Element UI的Table组件时,常常面对这样的业务需求: 表格数据的每一项都要提供勾选框,当切换分页时,能够记忆所有页面勾选的数据,以实现批量提交不同页面勾选数据的功能.并且, ...
- layui table 分页 记住之前勾选的数据
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- Dynamics CRM2013 sub grid中数据翻页问题
CRM2013中一个很低级很令人无语的BUG,见下图subgrid中的明细条目超过当前页设置的条目后会有翻页,在底下有个paging bar会显示条数.页数.当前所处页数 但sp1版本的CRM打上ur ...
- easyui grid中翻页多选方法
<table class="easyui-datagrid" title="人员选择" id="dg" data-options=&q ...
随机推荐
- POJ1088滑雪(记忆化搜索+DFS||经典的动态规划)
Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 84297 Accepted: 31558 Description M ...
- unity3d vs2012
Unity3D自带的MonoDevelop编辑器无论是js还是c#代码提示都很差,很诡异的就是变量名和方法名有的时候提示有的时候不提示.不过用Visual Studio代替MonoDevelop这个问 ...
- maven使用入门(pom)
mvn clean complie mvn clean test mvn clean package mvn clean install(该任务将该项目输出的jar安装到了Maven本地仓库中) 各个 ...
- 学习笔记day6:position index结合
z-index属性适用于定位元素(position 属性值为 relative 或 absolute 或 fixed的对象),用来确定定位元素在垂直于显示屏方向(称为Z轴)上的层叠顺序(stack o ...
- 简单RTOS学习(一) uc/os-II 工程模板建立
随着工业需求以及单片机性能越来越高,单个芯片能够且需要处理的任务也越来越多,使用传统前后台任务模式已经很难满足设计的需求,嵌入式实时操作系统正是在这种背景下发展起来,目前流行的有rt-thread,f ...
- html frames
http://blog.sina.com.cn/s/blog_67697189010116o0.html *********************************************** ...
- maven install 报错Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project*****
[ERROR]Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-co ...
- 【转载】PHP运行模式的深入理解
PHP运行模式的深入理解 作者: 字体:[增加 减小] 类型:转载 时间:2013-06-03我要评论 本篇文章是对PHP运行模式进行了详细的分析介绍,需要的朋友参考下 PHP运行模式有4钟:1) ...
- jstree级联查找树
<script > obj=$.jstree.reference($('#plugins4')); function PP(obj,e,filename){ if (obj.get_par ...
- js setTimeout 与 setInterval 以及 for 循环 刷新UI
1. setTimeout() 方法用于在指定的毫秒数后调用函数或计算表达式:执行一次: 如果需要执行多次,自身再次调用 setTimeout(): 示例:无穷循环并带停止按钮的 <html&g ...