1. #1
    Sencha User
    Join Date
    Jan 2012
    Posts
    1
    Vote Rating
    0
    petit_bab is on a distinguished road

      0  

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

    [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 :
    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 déroulante des fabricants
                    listeFabricant = 
                        new Ext.form.ComboBox({
                            editable: false,
                            triggerAction: 'all',
                            readOnly: true,
                            mode: 'remote',
                            store: new Ext.data.Store({
                                        proxy: new Ext.data.HttpProxy({url: 'json.php',method: "post"}),
                                        baseParams:{method: store_method},
                                        autoLoad: true,
                                        listeners: {
                                            load: function() {
                                                            listeFabricant.setValue(code);
                                                        }
    
                                        },
                                        reader: new Ext.data.JsonReader(
                                                                        {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
                    });
                
                lineItems.push(
                    listeFabricant,
                    textFieldReference
                );
                     
                // Ajoute la ligne
                var line = new Ext.Panel({
                   layout:      'column',
                   border:      false,
                   width:       700,
                   items:       lineItems
                });
    
                this.add(line);
                
            }
    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...

    Hakan.

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,795
    Vote Rating
    834
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Please post in the appropriate forum. I have moved this to the Ext JS 2 Help forum.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

Thread Participants: 1

Tags for this Thread

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi