1

我注意到在某些或我的网格上没有显示“displayMsg”。即右下角的文字。

如果你看下面的屏幕截图,我已经设置了 pageSize: 4. 总共有“33”条记录,所以应该开始分页。一般来说,分页不显示记录总数的原因是什么。

在此处输入图像描述

在此处输入图像描述

Ext.define('Mis.view.PurchaseOrder', {
extend: 'Ext.grid.Panel',
alias:'widget.purchaseorder',
title:'Purchase Order',
store:'MaterialPurchaseOrders',
height: 235,
dockedItems:[
    {
        xtype: 'pagingtoolbar',
        store:'MaterialPurchaseOrders',
        dock: 'bottom',
        displayInfo: true,
        displayMsg:'Displaying records {0} - {1} of {2}  ',
        emptyMsg:"No records to display ",
        flex:1
    }
],
columns:[
    {
        xtype:'gridcolumn',
        dataIndex:'PartName',
        name:'PartName',
        text:'Part',
        flex:1
    },
    {
        xtype:'gridcolumn',
        text:'PO ID',
        dataIndex:'PoNumber',
        name:'PoNumber',
        width: 80,
        align: 'center'
    },
    {
        xtype:'gridcolumn',
        text:'Material',
        dataIndex:'Name',
        name:'Name',
        flex:1
    },
    {
        xtype:'gridcolumn',
        text:'Total',
        dataIndex:'Total',
        name:'Total',
        width: 80,
        align: 'center'
    },
    {
        xtype:'gridcolumn',
        text:'Size / Ref',
        dataIndex:'SizeReference',
        name:'SizeReference',
        width: 80,
        align: 'center'
    },
    {
        xtype:'gridcolumn',
        text:'Size L',
        dataIndex:'SizeLength',
        name:'SizeLength',
        width: 80,
        align: 'center'
    },
    {
        xtype:'gridcolumn',
        text:'Size W',
        dataIndex:'SizeWidth',
        name:'SizeWidth',
        width: 80,
        align: 'center'
    },
    {
        xtype:'gridcolumn',
        text:'Quantity',
        dataIndex:'Quantity',
        name:'Quantity',
        width: 80,
        align: 'center'
    },
    {
        xtype:'gridcolumn',
        text:'Meterage',
        dataIndex:'Meterage',
        name:'Meterage',
        width: 80,
        align: 'center'
    }
],


initComponent:function () {
    this.callParent();
}

});

我的模型。

    Ext.define('Mis.model.MaterialPurchaseOrder', {
    extend: 'Ext.data.Model',
    idProperty: 'Id',
    fields: [
                {
                    mapping: 'Id',
                    name: 'Id'
                },
                {
                    mapping: 'Name',
                    name: 'Name'
                },
                {
                    mapping: 'SizeReference',
                    name: 'SizeReference'
                },
                {
                    mapping: 'SizeLength',
                    name: 'SizeLength'
                },
                {
                    mapping: 'SizeWidth',
                    name: 'SizeWidth'
                },
                {
                    mapping: 'Quantity',
                    name: 'Quantity'
                },
                {
                    mapping: 'Meterage',
                    name: 'Meterage'
                },
                {
                    mapping: 'PoNumber',
                    name: 'PoNumber'
                },
                {
                    mapping: 'PartId',
                    name: 'PartId'
                },
                {
                    mapping: 'PartName',
                    name: 'PartName'
                },
                {
                    mapping: 'Total',
                    name: 'Total'
                },
                {
                    mapping: 'MaterialType',
                    name: 'MaterialType'
                },
                {
                    mapping: 'MaterialTypeId',
                    name: 'MaterialTypeId'
                }
    ],
    proxy: {
        type: 'ajax',
        url: '',
        api:
               {
                   read: '/Material/ReadAssignedPurchaseOrder/',
                   update: '/Material/Update',
                   create: '/Material/Update',
                   destroy: '/Material/Remove'
               },
        reader: {
            type: 'json',
            root: 'Materials',
            successProperty: 'Success',
            totalProperty: 'Total'
        },
            writer:{
            type:'json',
            allowSingle:true
        }
    }
});

店铺

Ext.define('Mis.store.MaterialPurchaseOrders', {
extend: 'Ext.data.Store',
requires: 'Mis.model.MaterialPurchaseOrder',
model: 'Mis.model.MaterialPurchaseOrder',
pageSize: 4

});

4

1 回答 1

0

尝试为您的商店创建一个实例,这样做从来都不是坏事。使用您的示例(按字符串存储),如果您打开了 2 个网格并对它们进行排序,它们将排序相同,等等...

Ext.define('Mis.view.PurchaseOrder', {
    extend: 'Ext.grid.Panel',
    alias: 'widget.purchaseorder',
    title: 'Purchase Order',
    height: 235,
    columns: [
        {
        xtype: 'gridcolumn',
        dataIndex: 'PartName',
        name: 'PartName',
        text: 'Part',
        flex: 1},
    {
        xtype: 'gridcolumn',
        text: 'PO ID',
        dataIndex: 'PoNumber',
        name: 'PoNumber',
        width: 80,
        align: 'center'},
    {
        xtype: 'gridcolumn',
        text: 'Material',
        dataIndex: 'Name',
        name: 'Name',
        flex: 1},
    {
        xtype: 'gridcolumn',
        text: 'Total',
        dataIndex: 'Total',
        name: 'Total',
        width: 80,
        align: 'center'},
    {
        xtype: 'gridcolumn',
        text: 'Size / Ref',
        dataIndex: 'SizeReference',
        name: 'SizeReference',
        width: 80,
        align: 'center'},
    {
        xtype: 'gridcolumn',
        text: 'Size L',
        dataIndex: 'SizeLength',
        name: 'SizeLength',
        width: 80,
        align: 'center'},
    {
        xtype: 'gridcolumn',
        text: 'Size W',
        dataIndex: 'SizeWidth',
        name: 'SizeWidth',
        width: 80,
        align: 'center'},
    {
        xtype: 'gridcolumn',
        text: 'Quantity',
        dataIndex: 'Quantity',
        name: 'Quantity',
        width: 80,
        align: 'center'},
    {
        xtype: 'gridcolumn',
        text: 'Meterage',
        dataIndex: 'Meterage',
        name: 'Meterage',
        width: 80,
        align: 'center'}
    ],
    initComponent: function() {
        var me = this;
        var store = Ext.create('Mis.store.MaterialPurchaseOrders');

        Ext.applyIf(me, {
            store: store,
            dockedItems: [{
                xtype: 'pagingtoolbar',
                store: store,
                dock: 'bottom',
                displayInfo: true,
                displayMsg: 'Displaying records {0} - {1} of {2}  ',
                emptyMsg: "No records to display ",
                flex: 1}]
        });
        me.callParent();
    }
});​
于 2012-08-09T19:09:32.783 回答