1. #1
    Sencha User
    Join Date
    Aug 2010
    Posts
    17
    Vote Rating
    0
    lexusgs430 is on a distinguished road

      0  

    Default Making grid remember drop down combobox selection states

    Making grid remember drop down combobox selection states


    Hi,

    I am trying to drill down a grid based on a couple of different drop downs. The first is brand, the second is department. So Im trying to make it so you can filter by brand, and then department, to drill down the grids data. -- My problem is that I am using server side filtering and paging, so it will work, but if I try to drill down a second param while the first is already selected in the drop down, my app doesent recognize that the first is selected and resubmits the entire drill down process, using just the 1 field. -- So basically Im just wondering what the best practice is to accomplish this, in making the dropdowns aware of each other and their states. (and I was going to hack it up using a php session stored variable, but I figure there is a better way and possibly built in way to do this using extjs?)

    Here is the code Im working with.

    Code:
    var brandsCombo = {
    xtype: 'combo',
    store: brandsStore,
    displayField: 'name',
    valueField: 'id',
    editable: false,
    mode: 'remote',
    forceSelection: true,
    triggerAction: 'all',
    emptyText: 'Select a brand...',
    selectOnFocus: true,
        listeners: {
            'select': function(cmb, rec, idx) {
                stylesStore.load({
                  params: { 'brand_id': this.getValue() }
                });
            }
        }
    }
    Code:
    var deptCombo = {
    xtype: 'combo',
    store: deptStore,
    displayField: 'name',
    valueField: 'id',
    editable: false,
    mode: 'remote',
    forceSelection: true,
    triggerAction: 'all',
    emptyText: 'Select a Department...',
    selectOnFocus: true,
        listeners: {
            'select': function(cmb, rec, idx) {
                stylesStore.load({
                  params: { 'department_id': this.getValue() }
                });
            }
        }
    }
    Any help would be much appreciated!

  2. #2
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    83
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    Instead of specifying the parameter in the load params you should set the parameter in the store baseParams and reload the store, e.g.
    Code:
    stylesStore.setBaseParam('department_id', this.getValue());
    stylesStore.load();
    ps. This is also required to make paging work correctly.

  3. #3
    Sencha User
    Join Date
    Aug 2010
    Posts
    17
    Vote Rating
    0
    lexusgs430 is on a distinguished road

      0  

    Default


    worked perfectly, thanks man!

Similar Threads

  1. grid remember selection
    By pex in forum Ext 1.x: Help & Discussion
    Replies: 11
    Last Post: 22 Feb 2011, 9:46 AM
  2. "remember" grid selection between loads
    By paulsschwarz in forum Community Discussion
    Replies: 0
    Last Post: 31 Aug 2008, 10:08 AM
  3. Remember Selection for Paging Table
    By michik in forum Ext GWT: Help & Discussion (1.x)
    Replies: 4
    Last Post: 27 Aug 2008, 11:42 AM
  4. Replies: 3
    Last Post: 24 Aug 2007, 2:42 AM

Thread Participants: 1

Tags for this Thread