pagingtoolbar只是给你显示一个翻页的工具条,具体事件还得自己写

解决方案 »

  1.   

    不是吧,我就是想瞬间加载好数据,然后翻页,和后台没什么关系,看demo也没有哪里有些翻页事件自己写啊
      

  2.   

    重新改了下,以下代码为什么会没有数据,用注释掉的部分就对了,  
    Ext.Loader.setConfig({enabled: true});Ext.Loader.setPath('Ext.ux', '../ux/');Ext.require([
        'Ext.data.*',
        'Ext.tip.QuickTipManager',
        'Ext.form.*',
        'Ext.ux.data.PagingMemoryProxy',
        'Ext.grid.Panel'
    ]);Ext.onReady(function(){
        MultiLangDemo = (function() { 
            return {
                init: function() { 
                 this.setupDemo();
                },
                
                setupDemo: function() { 
           
                  var monthArray=new Array(); 
                 for(var i=1;i<100;i++){ 
                    monthArray[i]=i;
                  } 
                 //monthArray=['15','2','3']; 直接用这个就对了,那么我动态添加的数组为什么就不行?? 
                    var ds = Ext.create('Ext.data.Store', {
                         fields: ['num'], 
                         remoteSort: true,
                         pageSize: 6,
                         proxy: {
                             type: 'pagingmemory',
                             data: monthArray,
                             reader: {
                                 type: 'array'
                             }
                         }
                     });
                                 
                     Ext.create('Ext.grid.Panel', {
                         renderTo: 'grid',
                         width: 380,
                         height: 203,
                         title:'Month Browser',
                          selModel: new Ext.selection.CheckboxModel, //添加checkbox列
                         columns:[{
                             text: 'Month of the year',
                             dataIndex: 'num',
                             width: 240 
                         }],
                         store: ds,            
                         bbar: Ext.create('Ext.toolbar.Paging', {
                                 pageSize: 6,
                                 store: ds,
                                 displayInfo: true
                         })
                     });
                
                    // trigger the data store load
                    ds.load();            
                }
            };
        
        })();
        MultiLangDemo.init();
    });
      

  3.   

    读数据时加载分页信息。
    每页20条数据:grid.store.load({params:{start: 0, limit: 20}}); 
      

  4.   

    没用啊,是不是我用错了 Ext.require([
        'Ext.data.*',
        'Ext.grid.*'
    ]);Ext.onReady(function(){
        Ext.define('Book',{
            extend: 'Ext.data.Model',
            fields: [ 
                {name: 'Author', mapping: 'ItemAttributes > Author'},
                'Title', 'Manufacturer', 'ProductGroup'
            ]
        });    // create the Data Store
        var store = Ext.create('Ext.data.Store', {
            model: 'Book',
            autoLoad: true,
            pageSize:5,
            proxy: { 
                type: 'ajax',
                url: '../sheldon.xml', 
                reader: {
                    type: 'xml', 
                    record: 'Item',
                    idProperty: 'ASIN',
                    totalRecords: '@total'
                }
            }
        });
        
        // create the grid
        var pagingToolbar=new Ext.PagingToolbar({
          pageSize:5,
             store: store,
             displayInfo: true,
          emptyMsg: '没有数据', 
             displayMsg: '当前显示{0}-{1}条记录 / 共{2}条记录 ',
             beforePageText: '第',
             afterPageText: '页/共{0}页'   
        });
        
        var grid = Ext.create('Ext.grid.Panel', {
         width: 540,
           
            store: store,
            frame:true,
         //   loadMask:true,
            selModel: new Ext.selection.CheckboxModel, //添加checkbox列
            columns: [
                {text: "Author", flex: 1, dataIndex: 'Author', sortable: true},
                {text: "Title", width: 180, dataIndex: 'Title', sortable: true},
                {text: "Manufacturer", width: 115, dataIndex: 'Manufacturer', sortable: true},
                {text: "Product Group", width: 100, dataIndex: 'ProductGroup', sortable: true}
            ], 
            bbar: pagingToolbar, 
            renderTo:'demo'
        }); 
        grid.store.load({params:{start: 0, limit: 5}}); 
    });
      

  5.   

    我就是想知道,获取数据之后,如何分页显示,无论是本地还是xml,还是ajax,都可以获取到数据,但是获取后全部显示在了一页内,分页工具可以点击,但是摆设一样,那么我到底是哪里写错了??
      

  6.   

    //for(var i=1;i<100;i++){ 
      for(var i=0;i<100;i++){ //要从0开始,要不monthArray[0]为undefined导致读取数据出错
                       monthArray[i]=i.toString();
                     }