1. #1
    Sencha Premium Member
    Join Date
    Mar 2012
    Location
    Boise, Idaho
    Posts
    84
    Answers
    3
    Vote Rating
    13
    PhilMerrell will become famous soon enough

      0  

    Default Answered: Adding items to a container in JSONP callback.

    Answered: Adding items to a container in JSONP callback.


    Not sure if this is a bug or not, but I'm trying to add Ext.Img items to an existing container in a JSONP callback. When I inspect the image container, all the Ext.Img's are registered as innerItems and not items. Only the last image added registers as an item in the container's items array.

    Code:
    Ext.define('MyApp.view.MyContainer', {
        extend: 'Ext.Container',
    
    
        config: {
            itemId: 'myContainer',
            listeners: [
                {
                    fn: 'onContainerShow',
                    event: 'show'
                }
            ]
        },
    
    
        onContainerShow: function(component, options) {
            Ext.data.JsonP.request({
                url: 'https://api.instagram.com/v1/tags/boisestate/media/recent?access_token=6453617.7048f76.66aa249b768743a0b61f2cfe90676420&callback=callbackFunction',
                callbackKey: 'callback',
                params: {client_id: '5e250c59a7f941a29ebffad4c21f7dbd'},
                success: function(result, request) {
    
    
                    //console.log(result);
                    if(result.meta.code === 200) {
    
    
                        instagramPics = result;
    
    
                        for(var i = 0 ; i < result.data.length; i++) {
    
    
                            var img =  Ext.create('Ext.Img',{
                                height: window.innerWidth / 3,
                                width: window.innerWidth / 3,
                                style: 'float: left;',
                                itemId: 'boiseStatePhotos',
                                src: result.data[i].images.thumbnail.url,
                                instagram: result.data[i]
                            });
    
    
    
    
                            component.insert(0,img);
                        }
    
    
    
    
    
    
                    } else { // When bad or no data comes back from instagram API
    
    
    
    
                        Ext.Msg.alert(":(", "Aw, snap. For some reason we can\'t load pics right now. Try again.");
    
    
                    }
    
    
                }
            });
    
    
    
    
            instagramContainer = component;
            console.log(instagramContainer);
    
    
        }
    
    
    });
    This behavior makes it difficult to add more items to the top of the container as well as impossible to removeAll.

    Is this behavior expected?

    Thanks!

  2. Regarding id's:

    1) id's must be globally unique
    2) itemId's must be unique within a container

    So, I'd say no, not a bug.

  3. #2
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,833
    Answers
    453
    Vote Rating
    609
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    Regarding id's:

    1) id's must be globally unique
    2) itemId's must be unique within a container

    So, I'd say no, not a bug.
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  4. #3
    Sencha Premium Member
    Join Date
    Mar 2012
    Location
    Boise, Idaho
    Posts
    84
    Answers
    3
    Vote Rating
    13
    PhilMerrell will become famous soon enough

      0  

    Default


    I did not know that itemId's have to be unique in a container. Thanks for taking a look.

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