Results 1 to 3 of 3

Thread: PAGINGTOOLBAR. HOW TO SEND EXTRA VARIABLES?

  1. #1
    Ext User
    Join Date
    May 2009
    Location
    Boston
    Posts
    4

    Question PAGINGTOOLBAR. HOW TO SEND EXTRA VARIABLES?

    HELP! I'M READY TO QUIT FOREVER!
    Despite my best efforts, I've been unable to populate and send an extra variable along with the default "start" and "limit" when implementing a PagingToolbar on a Grid. The code below shows a combobox of state values (statecombo). The state value must be sent with every post to the database to retrieve data. The code does post the state value the first time a state is chosen from the combobox, however after that the paging doesn't work. I am using baseParams: {state: statecombo.value} in the store to retrieve the statecombo value and send it with each Post, however it isn't working for Paging. FIREBUG shows that it is posting the state as null or empty when you click the paging buttons.
    POST
    action listing
    limit 20
    start 20
    state
    Any idea of how to retrieve the state combobox value and send it with each Paging post?

    - chris

    Code:
    var statecombo = new Ext.form.ComboBox({ typeAhead: true, triggerAction: 'all', lazyRender:true, mode: 'local', emptyText:'Select a state...', store: Ext.localdata.states, valueField: 0, displayField: 1, listeners: { select: function(){ store.load({ params: { start: 0, limit: 20, state: this.value } }) }}
    }); var
    store =new Ext.data.JsonStore({
    proxy:listproxy,
    remoteSort:false,
    baseParams:{state: statecombo.value, action:'listing'},
    idProperty:'i_cust', root:'data', totalProperty:'totalCount', fields:[ {name:'i_cust'}
    ,{name:'contact'}
    ,{name:'title'} ,{name:'comp_name'}
    ,{name:'address'} ...
    ]
    });
    var contactgrid =new Ext.grid.GridPanel({
    store: store,
    columns:[
    { id:'id', header:"ID", width:40, sortable:true, dataIndex:'i_cust'},
    { id:'contact', header:"Contact", width:100, sortable:true, dataIndex:'contact'},
    { id:'title', header:"Title", width:75, sortable:true, dataIndex:'title'}, { id:'company', header:"Company", width:150, sortable:true, dataIndex:'comp_name'},
    { header:"Address", width:120, sortable:true, dataIndex:'address'}, ... ], stripeRows:true,
    height:450, width:950, autoScroll:true, autoExpandColumn:'company', // paging bar on the bottom
    bbar:new Ext.PagingToolbar({
    pageSize: recordsperpage,
    store: store, buttonAlign:'right', displayInfo:true, displayMsg:'Displaying {0} - {1} of {2}', emptyMsg:"No records to display"
    })
    });
    var panel =new Ext.Panel( { ... items:[contactgrid] });
    panel.render('contactsdiv');
    //FIRST TIME STORE LOADS
    store.load({
    params:{state: statecombo.value, start:0, limit:20, action:'listing'}
    })
    Last edited by CHRISDEVELOPER; 29 Oct 2009 at 2:24 PM. Reason: modify title

  2. #2
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,890

    Default

    Obviously at the time you call the ComboBox constructor, and your code assembles the config object to pass into it, when it comes to setting the <parameter>.params.state property of it for the ComboBox to use MUCH LATER, it attempts to pull the "value" property from the current this reference.

    What IS the current this reference AT THE TIME THAT CONFIG OBJECT IS SET UP AND PASSED INTO THE CONSTRIUCTOR?

    Really. Read your code and understand what it does.

  3. #3
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,890

    Default

    You might scan the docs for a possibility.

    http://www.extjs.com/deploy/dev/docs...ber=queryParam

Posting Permissions

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