【分享】ExtJS grid可分组显示、expand插件、中文排序/行、单元格背景/字体颜色/静态分页

hoojo 2010-08-19 03:36:23
加精
上个周末在家写了2个关于grid的小案例,拿来给大家分享下;由于公司需要用到中文排序,其他的功能是自己加到案例中的
只是做个demo方便以后参考;前段时间论坛有网友需要改变grid的单元格颜色,这里也加入了。还添加了部分插件
重写了写方法;

案例1:

/***
* grid基础综合案例
* 添加分页Ext.data.PagingMemoryProxy、重写Ext.data.Store支持中文汉字拼音字母首字母排序、
* Ext.data.GroupingStore分组(GroupingStore继承Store的)、
* 改变列背景色、行背景色、字体颜色getRowClass方法和renderer函数onRenderAgeCol的使用技巧
* 添加分组、行收缩展开插件Ext.grid.RowExpander使用及重写Ext.grid.RowExpander组件的
* 添加Ext.grid.GroupingView的groupTextTpl方法的使用
* author: hoojo
* create by: 2010-8-14
*/

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>可分组显示、expand插件、中文排序的Grid/改变行背景/单元格背景/字体颜色/分页</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="content-Type" content="text/html; charset=utf-8">
<meta http-equiv="author" content="hoojo">
<meta http-equiv="blog" content="http://blog.csdn.net/IBM_hoojo">
<link rel="stylesheet" type="text/css" href="ext2/resources/css/ext-all.css">
<style type="text/css">
.rowOdd {
background-color: #EFF7FF;
color: white;
}

.rowEven {
background-color: #CAE3FF;
color: white;
}

.cellBG {
background-color: #FFDD99;
font-weight: bold;
}
</style>
<script type="text/javascript" src="ext2/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="ext2/ext-all.js"></script>
<script type="text/javascript" src="ext2/build/locale/ext-lang-zh_CN-min.js"></script>
<script type="text/javascript" src="jslib/PagingMemoryProxy.js"></script>
<!-- PagingMemoryProxy.js在ext-2.2\examples\locale可以找到 -->
<script type="text/javascript" src="jslib/RowExpander.js"></script>
<!-- RowExpander.jsext-2.2\examples\grid下可以找到-->
<script type="text/javascript" src="jslib/Ext.hoo.grid.ConformityGrid.js"></script>
</head>
<body>
</body>
</html>
/***
* grid基础综合案例
* 添加分页Ext.data.PagingMemoryProxy、重写Ext.data.Store支持中文汉字拼音字母首字母排序、
* Ext.data.GroupingStore分组(GroupingStore继承Store的)、
* 改变列背景色、行背景色、字体颜色getRowClass方法和renderer函数onRenderAgeCol的使用技巧
* 添加分组、行收缩展开插件Ext.grid.RowExpander使用及重写Ext.grid.RowExpander组件的
* 添加Ext.grid.GroupingView的groupTextTpl方法的使用
* author: hoojo
* create by: 2010-8-14
*/

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>可分组显示、expand插件、中文排序的Grid/改变行背景/单元格背景/字体颜色/分页</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="content-Type" content="text/html; charset=utf-8">
<meta http-equiv="author" content="hoojo">
<meta http-equiv="blog" content="http://blog.csdn.net/IBM_hoojo">
<link rel="stylesheet" type="text/css" href="ext2/resources/css/ext-all.css">
<style type="text/css">
.rowOdd {
background-color: #EFF7FF;
color: white;
}

.rowEven {
background-color: #CAE3FF;
color: white;
}

.cellBG {
background-color: #FFDD99;
font-weight: bold;
}
</style>
<script type="text/javascript" src="ext2/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="ext2/ext-all.js"></script>
<script type="text/javascript" src="ext2/build/locale/ext-lang-zh_CN-min.js"></script>
<script type="text/javascript" src="jslib/PagingMemoryProxy.js"></script>
<!-- PagingMemoryProxy.js在ext-2.2\examples\locale可以找到 -->
<script type="text/javascript" src="jslib/RowExpander.js"></script>
<!-- RowExpander.jsext-2.2\examples\grid下可以找到-->
<script type="text/javascript" src="jslib/Ext.hoo.grid.ConformityGrid.js"></script>
</head>
<body>
</body>
</html>




look:按照国家分组的,其中还按照中文排序及Expand插件、分组修改单元格、行背景色、字体颜色
...全文
12907 115 打赏 收藏 转发到动态 举报
写回复
用AI写文章
115 条回复
切换为时间正序
请发表友善的回复…
发表回复
乞儿不再叫江 2011-08-29
  • 打赏
  • 举报
回复
mark
开始领悟 2011-08-25
  • 打赏
  • 举报
回复
顶一个
Leo灬叔叔 2011-08-24
  • 打赏
  • 举报
回复
学习一下、、、、
ma1986 2011-08-24
  • 打赏
  • 举报
回复
楼主EXT很厉害啊 但我有个问题 如何动态添加分组啊?比如在grid里面 动态添加一个“法国”的分组 我正在做这方面的还请指教
XYM8xym 2011-06-15
  • 打赏
  • 举报
回复
目前不懂,先收藏了
anglehao 2011-06-14
  • 打赏
  • 举报
回复
多谢楼主分享,拿来学习学习
fwefe 2011-06-13
  • 打赏
  • 举报
回复
还可以
oneatree 2011-06-12
  • 打赏
  • 举报
回复
学习不错
kongfl888ong 2011-06-11
  • 打赏
  • 举报
回复
为什么不给个效果图呢...
丅个路口见 2011-05-28
  • 打赏
  • 举报
回复
学习了,很好。。。。
谭智宸 2011-05-20
  • 打赏
  • 举报
回复
不错,楼主辛苦了,正在学习中,受益匪浅
fanyongpeng11 2011-05-12
  • 打赏
  • 举报
回复
别这样,我还有家人。。。。。。。。。。。。。
joan_xyq 2011-05-10
  • 打赏
  • 举报
回复
收藏了,感谢楼主分享!
sd3187478 2011-04-20
  • 打赏
  • 举报
回复
不错!
mulangren1988 2011-04-20
  • 打赏
  • 举报
回复
楼至很是犀利啊,向楼主致敬!!
mulangren1988 2011-04-20
  • 打赏
  • 举报
回复
向楼主致敬!!
biqxuan 2011-04-15
  • 打赏
  • 举报
回复
[Quote=引用 7 楼 dragonsky_w 的回复:]
很好 ,我测试了一下,效果很不错,我又加上了复选框,效果更好……
[/Quote]

分享上来,给个下载地址
ccshigenvwa 2011-01-14
  • 打赏
  • 举报
回复
好强啊,我也只会通过ext.net做出这个效果要是JS版的有难度哦
BigBear 2011-01-13
  • 打赏
  • 举报
回复
蛮有意思的,以前没用过这个框架。
wavefly_liu 2010-11-03
  • 打赏
  • 举报
回复
很不错。Ext内置的中文排序是基于ascii的,楼主修改为基于汉语拼音的,非常有用
加载更多回复(81)

52,797

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 Ajax
社区管理员
  • Ajax
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧