Results 1 to 2 of 2

Thread: how to add extra params when NEXT PAGE clicked on pagingtoolbar

  1. #1
    Sencha User sunrong's Avatar
    Join Date
    Jun 2010
    Posts
    39
    Vote Rating
    0
      0  

    Default Answered: how to add extra params when NEXT PAGE clicked on pagingtoolbar

    I use EXTJS 4.2.1.

    Here is my DATA STORE.


    Ext.define("user",{ extend:"Ext.data.Model", fields:[ {name:'mobile',type:'string',sortable:true}, {name:'name',type:'string',sortable:true}, {name:'month',type:'string',sortable:true}, {name:'city',type:'string',sortable:true}, {name:'mail_number',type:'string',sortable:true} ]});var user = Ext.create("user",{});var ds = Ext.create("Ext.data.Store",{ model:'user', storeId:'s_user', pageSize: 20, proxy:{ type:'ajax', timeout: 40000, url:'JSONServlet', reader:{ type:'json', root:'rows' }, writer:{ type:'json' } }, autoLoad:false });And i add some params more when ds loads.

    ds.load({ params:{start:0, limit:20, 'type': Ext.getCmp('type').value, 'city': Ext.getCmp('city').value, 'date': Ext.getCmp('date').value, 'date1': Ext.getCmp('date1').value } })I put a pagingtoolbar on the bottom of the grid.


    var grid = Ext.create("Ext.grid.Panel",{ ... dockedItems :[{ xtype:'pagingtoolbar', store:Ext.data.StoreManager.lookup('s_user'), dock:'bottom', displayInfo:true }], ... store : Ext.data.StoreManager.lookup('s_user') }

    On the first page everything is OK, but when NEXT page is clicked, ds pramas don't POST to server. I look into the source. I find code like this.


    case "next": ds.load({params:{start: this.cursor+this.pageSize, limit: this.pageSize}}); break;
    how to make PAGE NEXT work as i want, I hope someone give me a hint.
    sun

  2. You can add use proxy.extraParams ...

    listener on store:
    Code:
    beforeload: function() {
        store.getProxy().extraParams = {}; // clear all previous
        store.getProxy().extraParams.search = 'myvalue';
    }

  3. #2
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,409
    Answers
    716
    Vote Rating
    504
      0  

    Default

    You can add use proxy.extraParams ...

    listener on store:
    Code:
    beforeload: function() {
        store.getProxy().extraParams = {}; // clear all previous
        store.getProxy().extraParams.search = 'myvalue';
    }

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •