|
Posted on
2009-11-18 00:14
漂泊雪狼
阅读( 972)
评论()
编辑
收藏
举报
![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif) Code 1 ///<reference path="./vswd-ext_2.0.2.js" /> 2![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif) Ext.onReady(function() { 3 var data = [ 4 [1,"wilson.fu",10], 5 [2,"wilson.fu2",20], 6 [3,"wilson.fu3",30] 7 ]; 8![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif) 9 var sqldata = new Array() ; 10 for(var i=0;i<10;i++) 11![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) ![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif) { 12 sqldata.push([i.toString(),"wilson.fu" + i.toString(),10*i]); 13 } 14![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif) 15![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) var sm = new Ext.grid.CheckboxSelectionModel( {handleMouseDown:Ext.emptyFn}); 16 var cm = new Ext.grid.ColumnModel([ 17 sm, 18![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) ![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif) {header:"编号",dataIndex:"id",sortable:true}, 19![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) ![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif) {header:"姓名",dataIndex:"name"}, 20![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) ![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif) {header:"排序值",dataIndex:"ordernum",sortable:true} 21 ]); 22![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif) 23![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) var store = new Ext.data.SimpleStore( { 24 fields:[ 25![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) ![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif) {name:"id"}, 26![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) ![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif) {name:"name"}, 27![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) ![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif) {name:"ordernum"} 28 ] 29 }); 30![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif) 31 store.loadData(sqldata); 32![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif) 33![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) var gd = new Ext.grid.GridPanel( { 34 renderTo:"grid", 35 cm:cm, 36 sm:sm, 37 store:store, 38 loadMask:true 39 }); 40![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif) 41![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) Ext.get("btn").on("click",function() { 42 var selections = gd.getSelectionModel().getSelections(); 43 debugger 44 //得到选择的行的值 45 }); 46![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif) 47 }); 48![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
|