GridPanel (群组管理)
来源:互联网 发布:手机麦克风测试软件 编辑:程序博客网 时间:2024/06/08 14:07
(实例图)
核心源码:
var cm = new Ext.grid.ColumnModel([{id:'id',header:'id',dataIndex:'id',hidden:true},{header:'img',dataIndex:'img',hidden:true},{header:'创建时间',dataIndex:'ctime',hidden:true},{header:'描述',dataIndex:'description',hidden:true},{header:'我的N群',dataIndex:'name',menuDisabled:true},{header:'在线情况',dataIndex:'currentpeople',menuDisabled:true}]);var store = new Ext.data.Store({ proxy : new Ext.data.ScriptTagProxy({url:'http://localhost:8080/pnote/group/list.action'}), reader: new Ext.data.JsonReader({ //totalProperty: 'totalCount', root: 'groups', id: 'post_id' },[ 'id','img','ctime','description','name','currentpeople' ]) }); store.load(); //store.load({params:{start:0, limit:10}}); var grouppanel = new Ext.grid.GridPanel({ //title:"我的群组",cm:cm,store:store,viewConfig: { forceFit:true },tbar: new Ext.Toolbar({ autoWidth:true, autoShow:true, items : [{ text : '搜索群组', handler: function() {}, iconCls:'searchgroup' }, { xtype : "tbseparator" }, { text : "退出群组", handler: function() { if (grouppanel.getSelectionModel().hasSelection()) { Ext.Msg.confirm('信息', '确定要退出当前所选群组?', function (btn) { if (btn == 'yes') { var row = grouppanel.getSelectionModel().getSelected(); Ext.Ajax.request({ url:"http://localhost:8080/pnote/group/quitgroup.action?", params:{ id:row.get("id") }, success: function(resp,opts) { store.remove(row); //执行删除 }, failure: function(resp,opts) { Ext.Msg.alert('错误', "服务器出错!!!"); } }); }else { } }); }else { Ext.Msg.alert("错误", "没有群组被选中,无法进行删除操作!"); } }, iconCls : "deltegroup" //图片样式, 需要自己寫css樣式,引入手寫的css,如果用自带会因为浏览器不兼容而不显示图片 }] }) /*bbar: new Ext.PagingToolbar({ pageSize: 10, store: store, displayInfo: true, displayMsg: '第{0} 到 {1} 条数据 共{2}条', emptyMsg: "没有数据" })*/}); grouppanel.addListener('rowcontextmenu', fnRightClick); var rightMenu = new Ext.menu.Menu( { id: "UserMenu", items: [ { id: 'enter', icon: '../images/groupin.png', //图标文件 handler: function() { if (grouppanel.getSelectionModel().hasSelection()) { var url = "http://localhost:8080/pnote/group/ingroup.action?id=" var row = grouppanel.getSelectionModel().getSelected(); url += row.get("id"); window.open(url); } }, text: '进入群组' }, { id: 'property', icon: '../images/groupp.png', //图标文件 handler: function() {}, text: '群组详情' } ] }); ///右键菜单 function fnRightClick(grouppanel, rowIndex, e) { grouppanel.getSelectionModel().selectRow(rowIndex); e.preventDefault(); rightMenu.showAt(e.getXY()); };
返回JSON数据:
stcCallback1001({groups:[{img:'null',id:1,ctime:'2012-08-16 00:00:00.0',description:'这是一个学习java的好地方'
,name:'java群组',currentpeople:'0/1'},{img:'null',id:2,ctime:'2012-08-09 00:00:00.0',description:'这是学习C
++ 最好的群组',name:'C++群组',currentpeople:'0/1'},{img:'null',id:3,ctime:'2012-08-01 00:00:00.0',description
:'教你如何养猪',name:'养猪群组 ',currentpeople:'0/1'},{img:'null',id:4,ctime:'2012-08-17 00:00:00.0',description
:'教你如和作词啊',name:'做菜群»„',currentpeople:'0/1'}]})
前台请求情况:
- GridPanel (群组管理)
- EXT gridPanel(总结最终版)
- extjs之-gridpanel完全操作(事件)
- Extjs 学习 --Ext.grid.GridPanel()(一)
- ext2.0中GridPanel(7)
- java web ext 例子(jsonstore ,gridpanel,formpanel)
- ExtJs中获得(GridPanel)选中的当前选中行号
- Ext.grid.GridPanel 单双行颜色样式(斑马线)
- Extjs 组件继承 模板说明(以GridPanel为例)
- 啦啦啦Ext.Net(一):Ext:GridPanel概述
- Extjs GridPanel用法详解(单元格点击事件)
- 扩展GridPanel
- 扩展GridPanel
- GridPanel 弹窗
- GridPanel显示
- ExtJS GridPanel
- GridPanel分页
- 动态GridPanel
- 2012.9.8计划并昨日总结
- DB2中出现SQL1032N错误现象时的解决办法
- 玩了这么久小游戏终于赢了。合影留念一下。
- 未能加载文件或程序集“CrystalDecisions.Web, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e13
- CSS Hack 浏览器兼容写法 用法
- GridPanel (群组管理)
- PowerDesigner(四)-业务处理模型
- sql学习笔记
- stm32f407之了解编程环境
- vim常用命令
- 计算机视觉方面的代码
- stm32f407之GPIO(操作寄存器)
- 如何在面试时写出高质量的代码
- stm32f407之NVIC