Results 1 to 2 of 2

Thread: [Ext JS 2.3] Ext.Store loading issue within loop [ really need help please :( ]

  1. #1
    Sencha User
    Join Date
    Jan 2012
    Vote Rating

    Exclamation [Ext JS 2.3] Ext.Store loading issue within loop [ really need help please :( ]

    Ok so it's been hours now that I have been stuck on this issue. And I really don't understand what is going on here.

    I have a loop in which I create dynamically an Ext combobox and fill it with data from a json store. Data is correctly loaded in the comboboxes. But after that, I just want to select the good value in each combo. To do this, I have added a listener to the store object. Here is the code :
            for (var i = 0; i < invoiceLines.length; i++) {
                var lineItems = [];
                // Ajoute le fabricant
                var store_method = '';
                var display_txt = false;
                var listeFabricant = null;
                var code = invoiceLines[i].code;
                var real_id = invoiceLines[i].realId;
                    // Ajoute une liste droulante des fabricants
                    listeFabricant = 
                        new Ext.form.ComboBox({
                            editable: false,
                            triggerAction: 'all',
                            readOnly: true,
                            mode: 'remote',
                            store: new{
                                        proxy: new{url: 'json.php',method: "post"}),
                                        baseParams:{method: store_method},
                                        autoLoad: true,
                                        listeners: {
                                            load: function() {
                                        reader: new
                                                                        {root: 'manufacturers',
                                                                            totalProperty: 'results',
                                                                            fields: [{name: 'code'}, {name: 'name'}]
                            displayField : 'name',
                            valueField: 'code',
                            name: 'new_manufacturer_' + invoiceLines[i].realId,
                            hiddenName: 'hidden_new_manufacturer_' + invoiceLines[i].realId
                // Ajoute la reference
                var textFieldReference = 
                    new Ext.form.TextField({
                        name: 'new_reference_' + invoiceLines[i].realId,
                        value: invoiceLines[i].reference
                // Ajoute la ligne
                var line = new Ext.Panel({
                   layout:      'column',
                   border:      false,
                   width:       700,
                   items:       lineItems
    Problem is : the data is correctly loaded on all the combo but the selection (setValue) is made only in the last combobox. For example, when I have three comboboxes, only the value of the last combo is correctly selected...

    I have been working all day on this issue and clearly don't have a clue of what the hell is wrong in this code...

    Thanks for the help guys...


  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Gainesville, FL
    Vote Rating


    Please post in the appropriate forum. I have moved this to the Ext JS 2 Help forum.
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch

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