首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >网格面板中的ExtJs 5.1分页工具栏

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

Stack Overflow用户
提问于 2015-04-29 20:34:14
回答 1查看 1.4K关注 0票数 0

使用ExtJS 5.1,当我加载网格面板时,它在分页工具中显示正确的分页号。但在页面加载期间,它总是显示第1页,共5页。上一页和下一页按钮被禁用。

代码语言:javascript
复制
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);            
        }     
   }
});

分页工具栏定义如下。

bbar:

代码语言:javascript
复制
 Ext.create('Ext.PagingToolbar', {

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

不知道我到底是什么missing.Thanks

EN

回答 1

Stack Overflow用户

发布于 2015-04-29 23:08:36

嗨,你的代码看起来是正确的。这是我的分页的一个工作示例。

代码语言:javascript
复制
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();
},

商店:

代码语言:javascript
复制
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'
}],
});
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/29943901

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档