日期:2014-05-16 浏览次数:20351 次
var cm = new Ext.grid.ColumnModel([ {header:'ROLEID', dataIndex:'ROLEID',width:0,hidden:true}, {header:'角色名', dataIndex:'ROLENAME', sortable:true,width:480} ]); // 数据源 store = new Ext.data.Store({ url: '../EgsmWebService.asmx/getRoles', reader: new Ext.data.XmlReader( { totalRecords: 'rolecount', record: 'roleinfo' }, [ {name:'ROLEID'}, {name: 'ROLENAME'} ] ) }); store.setDefaultSort('ROLEID', 'asc'); var bbar = new Ext.PagingToolbar( { pageSize: 12, store: store, displayInfo: true, displayMsg: '当前显示 {0} - {1} 条,共 {2} 条', emptyMsg: "无数据" } ); // GridPanel 组件 grid = new Ext.grid.GridPanel({ frame: true, sortable:true, enableHdMenu: false, width :480, height:300, loadMask: {msg:'正在加载数据,请稍侯……'}, store: store, cm: cm, el:'rolegrid', bbar: bbar, viewConfig: { forceFit:true } }); grid.on("cellclick",function (g,r,c,e){ ds = grid.getStore(); record=grid.getSelectionModel().getSelected(); }); grid.addListener('rowdblclick',function(t,r,e){}); grid.render(); store.load({params:{start:0,limit:12}});
<% request.setCharacterEncoding("utf-8"); String _start = request.getParameter("start"); String _limit = request.getParameter("limit"); int start = Integer.parseInt(_start); int limit = Integer.parseInt(_limit); //返回的json字符串 String responseString = "{total:50,data:["; for(int i=0; i<limit; i++){ responseString+= ("{id: 'id" + i+start + "',name:'name" + i+start + "',email:'email" + i+start + "'}"); if(i!=limit-1){ responseString+= ","; } } responseString+="]}"; System.out.println(responseString); response.setCharacterEncoding("utf-8"); response.setContentType("text/json;charset=utf-8"); response.getWriter().write(responseString); response.flushBuffer(); response.getWriter().close(); %>