не работает пейджинг extjs - PullRequest
0 голосов
/ 04 февраля 2012

Я использую 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
    });
});

1 Ответ

1 голос
/ 05 февраля 2012

Вам просто нужно добавить панель инструментов подкачки в конфигурацию bbar вашей панели и подключить ее к тому же магазину, который использует ваша сетка.Смотрите пример: http://dev.sencha.com/deploy/ext-4.0.7-gpl/examples/grid/paging.html

Что-то вроде:

            bbar: Ext.create('Ext.toolbar.Paging', {
              store: store,
              displayInfo: true,
              displayMsg: 'Displaying items {0} - {1} of {2}',
              emptyMsg: "No items to display"
            })
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...