日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 前端技术 > javascript >内容正文

javascript

ExtJS中Grid分页

發布時間:2024/3/12 javascript 34 豆豆
生活随笔 收集整理的這篇文章主要介紹了 ExtJS中Grid分页 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

簡單記錄關鍵代碼,備忘、、、

1。定義一個jsonStore

??????? this.store = new Ext.data.JsonStore({
??????????? root: 'data',
??????????? totalProperty: 'totalCount',
??????????? idProperty: 'id',
??????????? remoteSort: true,
??????????? fields: [
??????????????? {name: 'id',type:'integer'},
{name: 'name',type:'string'},
??????????????? {name: 'sex',type:'string'},
??????????????? {name: 'dept',type:'string'}

??????????? ],
??????????? proxy: new Ext.data.HttpProxy({
??????????????? url: 'php/getInfoList.php?requesttype=GETUSERSLIST',
??????????????? method: 'GET'
??????????? })
??????? });
??????? this.store.setDefaultSort('id', 'asc');
??????? this.store.load({
??????????? params:{
??????????????? start:0,
??????????????? limit:25? //每次讀取25條記錄

??????????? }
??????? });

2。定義一個GridPanel

this.UsersGridList=new Ext.grid.GridPanel({
??????? width:700,
??????? height:500,
??????? store: this.store,
??????? loadMask: true,
??????? frame:true,
??????? layout:'fit',
??????? region: 'center',
??????? border: false,
?????? columns: [
??????? new Ext.grid.RowNumberer(),
??????? {
??????????? id:"id",
??????????? header: 'ID',
??????????? dataIndex: 'id',
??????????? sortable: true,
??????????? width:30
??????? },{
??????????? header: '姓名'
??????????? dataIndex: 'yhzt',
??????????? sortable: true,
??????????? width:80
??????? },{
??????????? header: '性別',
??????????? dataIndex: 'sex',
??????????? sortable: true
??????? },{
??????????? header: '工作單位'
??????????? dataIndex: 'dept',
??????????? sortable: true,
??????? }
?????? ],
??????? bbar:new Ext.PagingToolbar({
??????????? width:'100%',
??????????? store:this.store,
??????????? pageSize:25,
??????????? displayInfo:true,
??????????? displayMsg:'當前顯示第 {0} - {1} 條記錄/共{2}條記錄',
??????????? emptyMsg:'當前無記錄'
??????? })
??? });

3。php服務器端處理請求//

/**
???? * 獲取用戶信息列表
???? * 返回的格式為:
???? * {"success":true,"message":"獲取用戶信息列表成功","requesttype":"GETUSERSLIST",
???? * "data":
???? *????? [
???? *????????? {id:1,name:"管理員',sex:“男”,dept:"管理局"},
???? *????????? ...
???? *????? ]
???? * }
???? *
???? */
??? function processUsersList() {
??????? $query = "select count(*) from yonghu";
??????? if(! ($rs=$this->executeSQL($query)))??? return;
??????? $this->mReturns["totalCount"] = $rs->fields[0];
??????? $this->mSQL = "select id , name , sex , dept from yonghu order by {$_REQUEST['sort']} {$_REQUEST['dir']}
??????????????????? limit {$_REQUEST['limit']} offset {$_REQUEST['start']};";
??????? if(! ($rs=$this->executeSQL($this->mSQL)))??? return;
??????? $this->mReturns["success"] = true;
??????? $this->mReturns["requesttype"] = $_REQUEST['requesttype'];
??????? $this->mReturns["message"] = '獲取用戶信息列表成功';
??????? $this->mReturns["data"] = array();
??????? $i = 0;
??????? while(!$rs->EOF) {
??????????? $this->mReturns["data"][$i]["id"] = $rs->fields[0];
??????????? $this->mReturns["data"][$i]["name"] = $rs->fields[1];
??????????? $this->mReturns["data"][$i]["sex"] = $rs->fields[2];
??????????? $this->mReturns["data"][$i]["dept"] = $rs->fields[3];
??????????? $i++;
??????????? $rs->MoveNext();
??????? }
??? }

?

總結

以上是生活随笔為你收集整理的ExtJS中Grid分页的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。