Extjs Grid Paging工具栏显示网格中的所有数据

时间:2015-09-04 10:38:37

标签: php extjs

我正在尝试使用分页工具栏进行分页。分页工具栏工作正常。但是网格加载了所有数据。我该怎么做才能将部分数据加载到网格中以对网格执行分页控制。请帮帮我

//This is my code 


Ext.define('modelorderdetails', {
extend: 'Ext.data.Model',
fields: [
    {name: 'order_id', type: 'string'},
    {name: 'order_date', type: 'string'},
    {name: 'User_Type', type: 'string'},
    {name: 'fname', type: 'string'},
    {name: 'lname', type: 'string'},
    {name: 'product_name', type: 'string'},
    {name: 'quantity', type: 'string'},
    {name: 'email', type: 'string'},
    {name: 'telephone', type: 'string'},
    {name: 'shiping_method', type: 'string'},
    {name: 'shipping_charge', type: 'string'},
    {name: 'total_amount', type: 'string'},
    {name: 'address', type: 'string'},
    {name: 'city', type: 'string'},
    {name: 'state', type: 'string'},
    {name: 'postal_code', type: 'string'},
    {name: 'status', type: 'string'}
]
});

var orderdetailsStore = Ext.create('Ext.data.Store',
{
        model: 'modelorderdetails',
        autoload: false,
        pageSize: 5,
        proxy: new Ext.data.HttpProxy({
            type: 'ajax',
            url: 'orderDetailsHandler.php',
            reader: {
                type: 'json',
                model: 'modelorderdetails',
            }
        })
});



Ext.create('Ext.grid.Panel',
                        {
                            width: 630,
                            height: 400,
                            id: 'testgrid',
                            title: 'Search Results',
                            store: orderdetailsStore,
                            columns: [
                                {
                                    text: "Name",
                                    dataIndex: 'fname',
                                    width: 200,
                                    align: 'left',
                                    sortable: true
                                }],
                            dockedItems: [{
                                    xtype: 'pagingtoolbar',
                                    store: orderdetailsStore, 
                                    dock: 'bottom',
                                    displayInfo: true,
                                    pageSize: 5,
                                    displayMsg: '{0} - {1} of {2}',
                                    emptyMsg: "No topics to display",
                                }]
});                                 

//点击按钮,我试图显示记录    {     xtype:'按钮',     文字:' Go',     锚:' 10%',     id:' btnGo',

handler: function() {
var userId = Ext.getCmp("User").getValue();
var cmbStatusValue = Ext.getCmp("cmbStatus").getValue();
var fromdt = Ext.util.Format.date(Ext.getCmp("fromdate").getValue(), 'Ymd');
var todt = Ext.util.Format.date(Ext.getCmp("todate").getValue(), 'Ymd');

orderdetailsStore.load({
    params: {
             start: 0, 
             limit: 5,
             status: cmbStatusValue,
             user: userId,
             fromdate: fromdt,
             todate: todt,
            }
    });
}
},  

0 个答案:

没有答案