简体   繁体   English

网格面板中的ExtJs 5.1分页工具栏

[英]ExtJs 5.1 paging tool bar in grid panel

Using ExtJS 5.1, when I load grid panel it is showing correct paging number in paging tool. 使用ExtJS 5.1,当我加载网格面板时,它会在分页工具中显示正确的分页号。 but during page load time it always show Page 1 of 5. The Previous and Next Buttons are disabled. 但是在页面加载期间,它始终显示第1页(共5页)。“上一页”和“下一页”按钮被禁用。

#

var store = new Ext.data.Store({

    autoLoad: {params:{start: 0, limit: 5}},
    pageSize: 5,
    remoteSort: true, 
    model: 'TenantDetails',
    proxy: {
        type: 'ajax',
        enablePaging : true, 
        url: 'http://localhost:8080/restcountries-dev/rest/page/v0.5/tenant', 
        reader:  new Ext.data.JsonReader({
            type: 'json' ,              
            totalProperty:15,
            rootProperty:'tenant'
        })
    },
    listeners:{      
        load:function(store){            
            Ext.getCmp('tenant_detail_grid').getSelectionModel().select(0, true);            
        }     
   }
});

#

And Paging toolbar is defined as below. 并且分页工具栏定义如下。

bbar: bbar:

 Ext.create('Ext.PagingToolbar', {

        store: store,
        displayInfo: true, 
        displayMsg: '{0} - {1} of {2}',
        emptyMsg: "No topics to display"
    })

#

Don't know what exactly I'm missing.Thanks 不知道我到底想念什么。

Hi your code looks correct. 您好您的代码看起来正确。 Here's an working example of my paging. 这是我的分页的工作示例。

initComponent: function () {
    var me = this;

    me.store = Ext.create('Desktop.children.store.childrenStore');

    me.columns = [
        {
            text     : 'Nachname',
            dataIndex: 'lastName',
            flex: 1
        },
        {
            text     : 'Vorname',
            dataIndex: 'firstName',
            flex: 1
        },
        {
            text     : 'Gruppe',
            //name: 'group_id',
            dataIndex: 'groupName',
            flex: 1
        },
        {
            text     : 'Faktor',
            //name: 'group_id',
            dataIndex: 'factorName',
            flex: 1
        },
        {   
            xtype: 'datecolumn',
            text     : 'Geburtsdatum',
            dataIndex: 'birthdate',
            format: 'd.m.Y',
            flex: 1
        },
        {
            text     : 'Status',
            //name: 'group_id',
            dataIndex: 'isActive',
            flex: 1
        },
        {
                xtype: 'actioncolumn',
                width: 60,
                menuDisabled: true,
                items: this.LoadControlBar()
            }
    ];

    me.plugins = [{
        ptype:'saki-gridsearch'
        ,searchText: 'Suchen'
        ,autoTipText: 'Mindestens zwei Zeichen'
        ,selectAllText: 'Selektiere alle'
    }];

    me.bbar = me.paging = Ext.create('Ext.toolbar.Paging', {
         store:me.store
        ,displayInfo:true

    });


    me.tbar = [
        {
            xtype: 'button',
            id:'child_btn_add',
            text:'Kind hinzufügen',
            tooltip:'Neues Kind hinzufügen',
            iconCls:'add',
            hidden: (CheckPermission('Desktop.children.view.Mainwindow') != "WRITE"),
            handler:function(view, e){
                this.fireEvent('AddChildren', view, e);
            }
        },
        {
            xtype: 'button',
            id: 'btnChildExport',
            text: 'Liste exportieren',
            tooltip: 'Spezifische Liste exportieren',
            iconCls: 'exportList',
            handler: function(view, e){
                this.fireEvent('ExportList', view, e);
            }
        }
    ];

    me.callParent();
},

store: 商店:

Ext.define('Desktop.children.store.childrenStore', {
extend: 'Ext.data.Store',
id: 'childrenStore',
alias: 'widget.childrenStore',

requires: [
    'Desktop.children.model.childrenModel',
    'Ext.data.proxy.Memory',
    'Ext.data.reader.Array'
],


model: 'Desktop.children.model.childrenModel',
//autoLoad:true,
pageSize: 10,
proxy:
{
    type:'ajax',
    enablePaging: true,
    url:'resources/php/json.php',
    headers: { 'Content-Type': 'application/json' },
    extraParams:{
        data : JSON.stringify({
            module : "children",
            action : "load",
            jsonObject : null}),
        start: 0,
        limit: 10,
    },
    reader:{
        type:'json',
        rootProperty: 'Anfang'
    }
},

sorters: [{
        property : 'lastName',
        direction:'ASC'
}],
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM