1. #1
    Ext User
    Join Date
    Jan 2010
    Posts
    3
    Vote Rating
    0
    CayIT is on a distinguished road

      0  

    Default Load event not firing...

    Load event not firing...


    Hi there,

    I am trying to dynamically allocate some labels from a JsonStore to set field labels on a form. I have been debugging with firebug and it seems that my load event won't even fire. I have only been using ExtJS for a week so I am still pretty clueless with it. I'm hoping the problem is obvious, but my searches have yielded no positive results.

    Here is the Json object that my store is consuming:
    {"list": [
    {"lblId": "addr1", "label": "Address"},
    {"lblId": "addr2", "label": "Blank"},
    {"lblId": "addr3", "label": "Blank"}
    ]}

    Here is a snippit of my code:

    Code:
    var storelabels = new Ext.data.JsonStore( {
                url : 'bq050c.form?action=label',
                root : 'labels',
                //autoload: true,
                fields : [ 'lblId', 'label' ]
            });
    
    // set labels when load is fired
    storelabels.on('load', function() {
                 alert('test');     
                 Ext.getCmp("addr1").setFieldLabel(storelabels.getAt(0).get("label"));
             });
    
    // sets field label of form
    Ext.override(Ext.form.Field, {
                setFieldLabel : function(text) {
                    if (this.rendered) {
                        this.el.up('.x-form-item', 10, true).child('.x-form-item-label').update(text);
                    }
                    this.fieldLabel = text;
                }
            });
    The only way I have been able to successfully get my alert to show is by changing the event to 'beforeload.' When I do that however, I obviously have an error because the records don't exist yet.

    Thanks in advance.

    Cheers,

    I



    EDIT: Looks like I messed up the root on the Jsonstore. Fixed it and everything works now
    Last edited by CayIT; 2 Feb 2010 at 9:21 AM. Reason: Fixed it

  2. #2
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,498
    Vote Rating
    46
    Animal has a spectacular aura about Animal has a spectacular aura about

      0  

  3. #3
    jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    Frederick MD, NYC, DC
    Posts
    16,353
    Vote Rating
    80
    jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all

      0  

    Default


    I don't see where you're calling the store's load method. Are you sure you're even doing that?

  4. #4
    Ext User
    Join Date
    Jan 2010
    Posts
    3
    Vote Rating
    0
    CayIT is on a distinguished road

      0  

    Default


    Left that part out, but it was in the code.

    Everything works fine now away. I figured out what I was doing wrong when I tried listening for loadexceptions from the store.

    Cheers,
    I

  5. #5
    Ext User
    Join Date
    Aug 2009
    Posts
    588
    Vote Rating
    1
    Mike Robinson is on a distinguished road

      0  

    Default


    Can you quickly summarize, for the rest of us, what it turned out you were doing wrong?

    It helps (future readers) when a thread that reports a bug "comes to closure" about just what the problem was. (vs. "Never mind! I fixed it!")

  6. #6
    Ext User
    Join Date
    Jan 2010
    Posts
    3
    Vote Rating
    0
    CayIT is on a distinguished road

      0  

    Default


    I already edited into my original post how I was able to fix it, thanks.

    Cheers,
    Ira

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..."