0

I am trying to use paging toolbar for pagination. paging toolbar working fine. But the grid loading all the data. what can i do load some part of data into grid to perform paging control on grid. please help me

//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",
                                }]
});                                 

//And on button click i'm trying to display records { xtype: 'button', text: 'Go', anchor: '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,
            }
    });
}
},  
ShankarRade
  • 23
  • 1
  • 6
  • I have already solved this issue but using c# instead of PHP. I hope, you will understand the logic and can easily apply in PHP. http://stackoverflow.com/questions/31743023/paging-not-working-properly-in-extjs/31759315#31759315 – Puneet Chawla Sep 04 '15 at 11:03
  • Are you sure to use "start" and "limit" in your SQL ? – Benoit Cuvelier Sep 04 '15 at 12:11
  • Yes Benoit, but now it fetch only 5 (page size) records. – ShankarRade Sep 04 '15 at 12:35
  • Hi Puneet, I have seen your code, but now it shows only the first page if I click on next button. – ShankarRade Sep 05 '15 at 07:30
  • @ShankarRade - There may be any difference in PHP, but it's working properly in my system with using ExtJS and C#. – Puneet Chawla Sep 07 '15 at 06:18
  • Hi Puneet, its working now. When I'm clicking on next/prev button, in json response it create some garbage values of warnings and json data. so clear warnings and its working now. – ShankarRade Sep 07 '15 at 12:02
  • But now what happens, when I want to filter records with selecting values from combobox it come up with filtered records(e.g. totalcount=40 ) on first page but when click on next it get all records(e.g. totalcount=120). – ShankarRade Sep 07 '15 at 12:10

0 Answers0