Anand Mohan
Anand Mohan

Reputation: 79

i added paging but .all records dispalying in same page.i need to change dynamically

this is my store 

this is my view all records are showing in sigle page next button click what to change dynamically thats not working. i added pageing but .all records dispalying in same page.i need to change dynamically

can any one help

    var store = Ext.create('Ext.data.Store', {
         fields: ['name','email'],
            pageSize : 10,
            data: [
                   {name: 'Name1',    email: '[email protected]'},
                   {name: 'Name2',    email: '[email protected]'},

                   {name: 'Name3',    email: '[email protected]'},
                   {name: 'Name4',    email: '[email protected]'},
                   {name: 'Name5',    email: '[email protected]'},
                   {name: 'Name6',    email: '[email protected]'},
                   {name: 'Name7',    email: '[email protected]'},

                   {name: 'Name8',    email: '[email protected]'},
                   {name: 'Name9',    email: '[email protected]'},
                   {name: 'Name10',    email: '[email protected]'},
                   {name: 'Name11',    email: '[email protected]'},
                   {name: 'Name12',    email: '[email protected]'},

                   {name: 'Name13',    email: '[email protected]'},
                   {name: 'Name14',    email: '[email protected]'},
                   {name: 'Name15',    email: '[email protected]'},
                   {name: 'Name16',    email: '[email protected]'},
                   {name: 'Name17',    email: '[email protected]'},

                   {name: 'Name18',    email: '[email protected]'},
                   {name: 'Name19',    email: '[email protected]'},
                   {name: 'Name20',    email: '[email protected]'},
                   {name: 'Name21',    email: '[email protected]'},
                   {name: 'Name22',    email: '[email protected]'},

                   {name: 'Name23',    email: '[email protected]'},
                   {name: 'Name24',    email: '[email protected]'},
                   {name: 'Name25',    email: '[email protected]'},
                   {name: 'Name26',    email: '[email protected]'},
                   {name: 'Name27',    email: '[email protected]'},

                   {name: 'Name28',    email: '[email protected]'},
                   {name: 'Name29',    email: '[email protected]'},
                   {name: 'Name30',    email: '[email protected]'},
                   {name: 'Name31',    email: '[email protected]'},
                   {name: 'Name32',    email: '[email protected]'},

                   {name: 'Name33',    email: '[email protected]'},
                   {name: 'Name34',    email: '[email protected]'},
                   {name: 'Name35',    email: '[email protected]'},



            ]

        });

this is my view

    Ext.define('AM.view.user.List' ,{
        extend: 'Ext.grid.Panel',
        alias: 'widget.userlist',

        title: 'All Users',





        initComponent: function() {

            Ext.create('Ext.grid.Panel', {
              title: 'Column Demo',
              store:store,
              columns: [
                  {header: 'Name',  dataIndex:'name',flex:1},
                  {text: 'Email',  dataIndex:'email',flex:1},

              ],

             renderTo:'example-grid',
             width: 350,
             height: 280,
          dockedItems: [{
              xtype: 'pagingtoolbar',   // paging
              store: store,   // same store GridPanel is using
              dock: 'bottom',  
              pageSize: 10,
              displayInfo: true
          }],






              renderTo: Ext.getBody()
            });


          this.callParent(arguments);
      }



    });

this is my view all records are showing in sigle page next button click what to change dynamically thats not working. i added pageing but .all records dispalying in same page.i need to change dynamically

can any one help

Upvotes: 0

Views: 1054

Answers (2)

existdissolve
existdissolve

Reputation: 3124

Is you data always going to be local? If yes, you can configure paging on an in-memory data set with the memory proxy. In Ext JS 4, you can use the Ext.ux.data.PagingMemoryProxy. In Ext JS 5, this functionality has been incorporated into the Ext.data.proxy.Memory class via enablePaging:true:

// for Ext JS 5
mystore = Ext.create('Ext.data.Store', {
   fields: [...],
   data: [...],
   proxy: {
      type: 'memory',
      enablePaging: true
   }
})

Be aware, however, that this will only work if your dataset is in-memory. If your store is going to be loaded via a server proxy, then you'll need to follow the suggestions already provided.

Upvotes: 1

Surya Prakash Tumma
Surya Prakash Tumma

Reputation: 2193

In Ext js we can't implement paging only at client side.Please go through the post.. paging in extjs 4 grid is not working and through the sencha docs as wells

Upvotes: 0

Related Questions