![數(shù)據(jù)篇(8):ExtJs中強大的GridPanel組件進階_第1頁](http://file3.renrendoc.com/fileroot_temp3/2022-6/3/e9b9098b-fd1b-44c0-8692-c09f5bcf6f7b/e9b9098b-fd1b-44c0-8692-c09f5bcf6f7b1.gif)
![數(shù)據(jù)篇(8):ExtJs中強大的GridPanel組件進階_第2頁](http://file3.renrendoc.com/fileroot_temp3/2022-6/3/e9b9098b-fd1b-44c0-8692-c09f5bcf6f7b/e9b9098b-fd1b-44c0-8692-c09f5bcf6f7b2.gif)
![數(shù)據(jù)篇(8):ExtJs中強大的GridPanel組件進階_第3頁](http://file3.renrendoc.com/fileroot_temp3/2022-6/3/e9b9098b-fd1b-44c0-8692-c09f5bcf6f7b/e9b9098b-fd1b-44c0-8692-c09f5bcf6f7b3.gif)
![數(shù)據(jù)篇(8):ExtJs中強大的GridPanel組件進階_第4頁](http://file3.renrendoc.com/fileroot_temp3/2022-6/3/e9b9098b-fd1b-44c0-8692-c09f5bcf6f7b/e9b9098b-fd1b-44c0-8692-c09f5bcf6f7b4.gif)
![數(shù)據(jù)篇(8):ExtJs中強大的GridPanel組件進階_第5頁](http://file3.renrendoc.com/fileroot_temp3/2022-6/3/e9b9098b-fd1b-44c0-8692-c09f5bcf6f7b/e9b9098b-fd1b-44c0-8692-c09f5bcf6f7b5.gif)
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)
文檔簡介
1、數(shù)據(jù)篇數(shù)據(jù)篇(8):ExtJs中強大的中強大的GridPanel組件組件進階進階講師:風(fēng)舞煙ExtJs版版國訊教育通用智能國訊教育通用智能OA辦公平臺辦公平臺Ext.grid.GridPanel簡介Ext.grid.GridPanel用法示例GridPanel+SimpleStoreGridPanel+JsonStoreGridPanel+XmlStoreGroupingStore結(jié)合GroupView的使用 GridPanel中renderer詳解GridPanel的CRUD功能模擬類類Ext.grid.GridPanel 包: Extgrid 定義的文件: GridPanel.js 類全稱
2、: Ext.grid.GridPanel 繼承自于: Ext.Panel 此類系基于Grid控件的一個面板組件,呈現(xiàn)了Grid的主要交互接口。Store :數(shù)據(jù)記錄的模型(行為單位 ) Column model : 列怎么顯示View : 封裝了用戶界面 selection model : 選擇行為的模型 ExtJS中的表格功能非常強大,包括了排序、緩存、拖動、隱藏某一列、自動顯示行號、列匯總、單元格編輯等實用功能。 表格由類Ext.grid.GridPanel定義,繼承自Panel,其xtype為grid。ExtJS中,表格Grid必須包含列定義信息,并指定表格的數(shù)據(jù)存儲器Store。表格的
3、列信息由類Ext.grid.ColumnModel定義、而表格的數(shù)據(jù)存儲器由Ext.data.Store定義,數(shù)據(jù)存儲器根據(jù)解析的數(shù)據(jù)不同分為SimpleStroe、JsonStore、GroupingStore等。 1、首先來看最簡單的使用表格(SimpleStroe)的代碼:GridPanel+ SimpleStroeExt.onReady(function() var data= 1, EasyJWeb, EasyJF, 2, jfox, huihoo,, 3, jdon, jdon, 4, springside, springside, ; var stor
4、e=new Ext.data.SimpleStore(data:data,fields:id,name,organization,homepage); var grid = new Ext.grid.GridPanel( renderTo:hello, title:中國Java開源產(chǎn)品及團隊, height:150, width:600, columns:header:項目名稱,dataIndex:name, header:開發(fā)團隊,dataIndex:organization, header:網(wǎng)址,dataIndex:homepage, store:store, autoExpandColu
5、mn:2 ); );表格的排序及隱藏列特性 Ext.onReady(function() var data= 1, EasyJWeb, EasyJF, 2, jfox, huihoo,, 3, jdon, jdon, 4, springside, springside, ; var store=new Ext.data.SimpleStore(data:data,fields:id,name,organization,homepage); var colM=new Ext.grid.ColumnModel(header:項目名稱,dataIndex:name, hi
6、dden :true, header:開發(fā)團隊,dataIndex:organization,sortable:true, header:網(wǎng)址,dataIndex:homepage); var grid = new Ext.grid.GridPanel( renderTo:hello, title:中國Java開源產(chǎn)品及團隊, height:200, width:600, cm:colM, store:store, autoExpandColumn:2 ); );給列添加超鏈結(jié)function showUrl(value) return +value+;Ext.onReady(function
7、() var data= 1, EasyJWeb, EasyJF, 2, jfox, huihoo,, 3, jdon, jdon, 4, springside, springside, ; var store=new Ext.data.SimpleStore(data:data,fields:id,name,organization,homepage); var colM=new Ext.grid.ColumnModel(header:項目名稱,dataIndex:name,sortable:true,header:開發(fā)團隊,dataIndex:organizat
8、ion,sortable:true, header:網(wǎng)址,dataIndex:homepage,renderer:showUrl); var grid = new Ext.grid.GridPanel( renderTo:hello, title:中國Java開源產(chǎn)品及團隊, height:200, width:600, cm:colM, store:store, autoExpandColumn:2 ); );GridPanel+JsonStore var data=id:1, name:EasyJWeb, organization:EasyJF, homepage:, id:2, name
9、:jfox, organization:huihoo, homepage:, id:3, name:jdon, organization:jdon, homepage:, id:4, name:springside, organization: springside, homepage: ; var store=new Ext.data.JsonStore(data:data,fields:id,name,organization,homepage); var colM=new Ext.grid.ColumnModel(header:項目名稱,dataIndex:n
10、ame,sortable:true, header:開發(fā)團隊,dataIndex:organization,sortable:true, header:網(wǎng)址,dataIndex:homepage,renderer:showUrl); var grid = new Ext.grid.GridPanel( renderTo:hello, title:中國Java開源產(chǎn)品及團隊, height:200, width:600, cm:colM, store:store, autoExpandColumn:2 );GridPanel+XmlStore 1 EasyJWeb EasyJF 2 jfox h
11、uihoo 3 jdon jdon 4 springside springside var store=new Ext.data.Store( url:dataXml.xml, reader:new Ext.data.XmlReader( record:row, id,name,organization,homepage) );function showUrl(value) return +value+;Ext.onReady(function() var store=new Ext.data.Store( url:dataXml.xml, reader:new
12、Ext.data.XmlReader( record:row, id,name,organization,homepage) ); var colM=new Ext.grid.ColumnModel(header:項目名稱,dataIndex:name,sortable:true, header:開發(fā)團隊,dataIndex:organization,sortable:true, header:網(wǎng)址,dataIndex:homepage,renderer:showUrl); var grid = new Ext.grid.GridPanel( renderTo:hello, title:中國J
13、ava開源產(chǎn)品及團隊, height:200, width:600, cm:colM, store:store, autoExpandColumn:2 ); store.load(); );類類Ext.data.GroupingStore 包: Ext.data 定義的文件: GroupingStore.js 類全稱: Ext.data.GroupingStore 繼承自于: Ext.data.Store 一個特殊的Store實現(xiàn),提供由字段中提取某一個來劃分記錄的功能。GroupingStore通常和Ext.grid.GroupingView一起用,來證明為分組GridPanel劃分data
14、 model。繼承自Ext.data.Store,為Store增加了分組功能.其它用法與Store一致,惟一需要注意的是使用GroupingStore時必須指定sortInfo信息增加了配置屬性groupField : String/用于分組的字段groupOnSort : Boolean/如果為真,將依排序字段重新分組,默認為假remoteGroup : Boolean/遠程排序當然也會多一個group方法groupBy( String field, Boolean forceRegroup ) : void顧名思義都是重新排序用的 下面是個簡單的示例 var arr= 1, 本, 拉登,
15、2, 笨, 拉登,3, 笨, 拉燈 ; var reader = new Ext.data.ArrayReader( id: 0, name: name, mapping: 1, name: occupation, mapping: 2 ); var store=new Ext.data.GroupingStore( reader:reader, groupField:name, groupOnSort:true, sortInfo:field: name, direction: ASC /使用GroupingStore時必須指定sortInfo信息 ); store.loadData(arr
16、); /GridPanel var grid = new Ext.grid.GridPanel( ds: store, columns: header: name, width: 20, sortable: true,dataIndex: name, header: occupation, width: 20,sortable: true, dataIndex: occupation , view: new Ext.grid.GroupingView( forceFit:true, groupTextTpl: text (values.rs.length values.rs.length 1
17、? Items : Item) ), frame.:true, width: 700, height: 450, collapsible: true, animCollapse: false, title: Grouping Example, renderTo: Div_GridPanel ); GridPanel中的renderer詳解gridpanel 列中 renderer函數(shù)參數(shù)說明 一、col : NumberThe column index二、fn : FunctionThe function to use to process the cells raw data to retu
18、rn HTML markup for the grid view. The render function is called with the following parameters:1、value : Object The data value for the cell.(單元格的值)2、metadata : Object An object in which you may set the following attributes一個可以設(shè)置下邊兩個屬性的對象) *css : String A CSS class name to add to the cells TD element. (給單元格的TD元素設(shè)置CSS的class名稱) *attr : String An HTML attribute definition string to apply to the data container element within the table cell (e.g. style=color:red;). (給單元格元素增加一個html的屬性)3、record : Ext.data.record The Ext.data.R
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
- 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025年制藥原料采購與管理合作協(xié)議范本
- 2025年??谪浳镞\輸從業(yè)資格考試答題模板
- 2025年公路施工勞務(wù)承包合同模板
- 2025年昆明貨運從業(yè)資格證考試試題和答案解析
- 2025年消防設(shè)備銷售協(xié)議
- 2025年西寧貨運從業(yè)資格證模擬考試試題答案
- 2025年公共區(qū)域清潔服務(wù)委托合同范文協(xié)議
- 2025年品牌宣傳視頻制作合同
- 煙草制品購銷員職業(yè)合同樣本(2025年)
- 廣州涉外經(jīng)濟職業(yè)技術(shù)學(xué)院《采訪與寫作》2023-2024學(xué)年第二學(xué)期期末試卷
- 計算機文化基礎(chǔ)單元設(shè)計-windows
- 創(chuàng)建動物保護家園-完整精講版課件
- 廣東省保安服務(wù)監(jiān)管信息系統(tǒng)用戶手冊(操作手冊)
- DNA 親子鑒定手冊 模板
- DB33T 1233-2021 基坑工程地下連續(xù)墻技術(shù)規(guī)程
- 天津 建設(shè)工程委托監(jiān)理合同(示范文本)
- 廣東中小學(xué)教師職稱評審申報表初稿樣表
- 部編一年級語文下冊教材分析
- 火炬及火炬氣回收系統(tǒng)操作手冊
- 北師大七年級數(shù)學(xué)下冊教學(xué)工作計劃及教學(xué)進表
- 菜肴成本核算(課堂PPT)
評論
0/150
提交評論