Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/extjs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/amazon-s3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
extjs分页不工作_Extjs - Fatal编程技术网

extjs分页不工作

extjs分页不工作,extjs,Extjs,我正在使用extjs创建一些丰富的接口,但在代码中添加分页时遇到了困难。有人能告诉我如何将分页正确地添加到此代码中吗 Ext.require([ 'Ext.data.*', 'Ext.grid.*' ]); Ext.onReady(function(){ Ext.define('Book',{ extend: 'Ext.data.Model', fields: [ // set up the fields mapp

我正在使用extjs创建一些丰富的接口,但在代码中添加分页时遇到了困难。有人能告诉我如何将分页正确地添加到此代码中吗

Ext.require([
    'Ext.data.*',
    'Ext.grid.*'
]);

Ext.onReady(function(){
    Ext.define('Book',{
        extend: 'Ext.data.Model',
        fields: [
            // set up the fields mapping into the xml doc
            // The first needs mapping, the others are very basic
            {name: 'Author', mapping: 'ItemAttributes > Author'},
            'Title', 'Manufacturer', 'ProductGroup'
        ]
    });

    // create the Data Store
    var store = Ext.create('Ext.data.Store', {
        model: 'Book',
        autoLoad: true,
        proxy: {
            // load using HTTP
            type: 'ajax',
            url: 'sheldon-2.xml',
            // the return will be XML, so lets set up a reader
            reader: {
                type: 'xml',
                // records will have an "Item" tag
                record: 'Item',
                idProperty: 'ASIN',
                totalRecords: '@total'
            }
        }
    });

    // create the grid
    var grid = Ext.create('Ext.grid.Panel', {
        store: store,
        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}
        ],
        renderTo:'example-grid-group-v3',
        width: 540,
        height: 200
    });
});

您只需要在gridpanel的bbar配置中添加一个分页工具栏,并将其连接到网格正在使用的同一个存储。请参见一个示例:

比如:

            bbar: Ext.create('Ext.toolbar.Paging', {
              store: store,
              displayInfo: true,
              displayMsg: 'Displaying items {0} - {1} of {2}',
              emptyMsg: "No items to display"
            })