grid简单实现分页

 var context_store = new Ext.data.Store({  
                url: 'context.jsp',  
                reader: new Ext.data.JsonReader({  
                    root: 'rows',  
                    totalProperty: 'results',  
                    id: 'contentPK' 
                },[  
                    'contentPK',  
                    'msgPK',  
                    'madePersonPK',   
                    'madePersonName',     
                    'madeDate',   
                    'subject',    
                    'content',    
                    'attachmentNo',   
                    'remoteAddr',     
                    'personNamesOfNeedReply',     
                    'personNamesOfNotReply' 
                ])  
            });   
              
              
            var context_grid_v = new Ext.grid.GridPanel({  
                title:'回复列表',  
                id : 'context-grid',  
                //xtype: 'grid',  
                frame: false,  
                //width:300,  
                store: context_store,  
                region: 'center',  
                columns: [  
                    {header: 'ContentPK', dataIndex: 'contentPK',sortable: true},  
                    {header: 'msgPK', dataIndex: 'msgPK',sortable: true},  
                    {header: '主题', dataIndex: 'subject',sortable: true},  
                    {header: '内容', dataIndex: 'content'},  
                    {header: '写信人', dataIndex: 'madePersonName'},  
                    {header: '写信日期',dataIndex: 'madeDate', sortable: true},  
                    {header: 'IP地址', dataIndex: 'remoteAddr'},  
                    {header: '收件人(要回)', dataIndex: 'personNamesOfNeedReply'},  
                    {header: '收件人', dataIndex: 'personNamesOfNotReply'}  
                ],  
                stripeRows: true,  
                sm: new Ext.grid.RowSelectionModel({  
                    singleSelect: true 
                }),  
                tbar:[' ', '写信日期:' 
                    , {  
                        xtype: 'datefield' 
                    }, ' ',  
                    '写信人:',  
                    {  
                        xtype:'textfield',  
                        width:70  
                    },' ',{  
                        xtype:'button',  
                        text:'查询' 
                }],  
                bbar: new Ext.PagingToolbar({  //分页工具 
                    pageSize: 20,  
                    store: context_store,  
                    displayInfo: true,  
                      
                })  
            });

 

 

引用于http://www.iteye.com/problems/49860中的代码对

你可能感兴趣的:(jsp,ext)