Results 1 to 4 of 4

Thread: linked combos in a wizard

  1. #1

    Default linked combos in a wizard

    Hi all , i been banging my head for 2 days now and i cannot find the solution.

    Im using the extension wizard to make a wizard.

    in step 1 (card 1) i have a dropdown asking for the country
    in step 2 depending on the selected country value i want to load the suppliers within the selected country in a dropdown.

    But no matter what i try it will not work.
    however i see the store reloads with good selected values
    but somehow the combo is always empty .....


    the store for the second combo
    HTML Code:
    [left]var Wizzard_supplierstore = new Ext.data.JsonStore({
    url: 'json_suppliers_combo2.php',
    autoLoad: true,
    fields: [{
    name: 'PID'
    }, {
    name: 'PNAME',
    type: 'string'
    }]});[/left]
    The first combo:

    HTML Code:
    [left]{
    xtype: 'combo',
    name: 'prov_country',
    id: 'prov_country',
    listeners: {
    
    // 'change' will be fired when the value has changed and the user exits the ComboBox via tab, click, etc.
    // The 'newValue' and 'oldValue' params will be from the field specified in the 'valueField' config above.
    select: function(combo){
    
    region = Ext.getCmp('name_supplier');
    //region.lastQuery = null;
    region.clearValue();
    Wizzard_supplierstore.reload({
    params: {
    cid: combo.getValue()
    }
    });
    /*Wizzard_supplierstore.filter('cid', combo.getValue());*/
    
    alert(combo.getValue());
    }
    },
    store: new Ext.data.JsonStore({
    url: 'json_countries.php',
    
    autoLoad: false,
    fields: [{
    name: 'ID'
    }, {
    name: 'NAME',
    type: 'string'
    }]
    
    }),
    forceSelection: true,
    fieldLabel: 'Country',
    displayField: 'NAME',
    valueField: 'ID',
    hiddenName: 'ID',
    allowBlank: false,
    
    typeAhead: false,
    mode: 'remote',
    triggerAction: 'all',
    emptyText: 'Select a country...',
    selectOnFocus: true,
    anchor: '90%'[/left]
    }
    and the second combo.

    HTML Code:
    {
    xtype: 'combo',
    id: 'name_supplier',
    //autoLoad: true,
    name: 'name_supplier',
    store: Wizzard_supplierstore,
    fieldLabel: 'Supplier',
    displayField: 'PNAME',
    valueField: 'PID',
    hiddenName: 'PID',
    allowBlank: false,
    forceSelection: true,
    typeAhead: true,
    mode: 'local',
    
    lastQuery: '',
    triggerAction: 'all',
    emptyText: 'Select a supplier...',
    selectOnFocus: true,
    anchor: '90%'
    HTML Code:
    }
    [LEFT][/LEFT]

  2. #2
    Sencha User jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    DC Area =)
    Posts
    16,364

    Default

    First things first, you need to learn how to properly post formatted code.

    Second, the "Wizard" layout is irrelevant! you need to focus on the problem at hand, which is linking combos.

    third, stop using global variables.

    fourth, setup load and exception listeners in the second combo store and debug what's going on. Could it be your data does not match what fields are configured? It's hard to tell with what you've prevented. are you familiar with firebug?

  3. #3

    Default hi

    Hi thanks for your time as im really gettin crazy with this as it will be the third day to load a simple dropdown based on a variable. just mad.

    Yes i have firebug and on reloading the store i can see the right data is being loaded with the right parameter ( selected value from combo1)

    however in the combo there is no data at all.

    about formatting the code , its properly formatted in my aptana editor (eclipse) but when pasting it here, it does it alone .

    Then when u talk about global variables , i dont see another way to define this store , as i need to reload it based on the select listener in the first combo so i need to be able to identify the store.
    for this

    var store = ...



    im going to look into this exception listeneres , but im really lost at this stage.

    also i wont need any other fields
    i mean
    in the second dropdown i need the data loaded for this query

    select id,name from suppliers where countryID = cid



    i just need id and name as defined in the store.

    what i dont understand if in firebug i see the store gets loaded properly how come theres no data in the frikken combo?

    Thanks

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

    Default

    Your Store is not loading. Add a loadexception listener to it.

    Or step through its loading process.

    Format your code properly. What's this [left] stuff? Where's the regular indentation?

Posting Permissions

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