1. #1
    Sencha User deccard's Avatar
    Join Date
    Jan 2008
    Location
    Chesterfield, UK
    Posts
    28
    Vote Rating
    0
    deccard is on a distinguished road

      0  

    Default Scoping help needed...

    Scoping help needed...


    I'm trying to derive my own editorGrid widget from the EditorGridPanel - all is working well except a [hopefully minor] problem with scoping ..

    The lines commented out are all working and all renders and works as required - the problem is that i want a button on the top toolbar of the grid to add a row to the grid [see 'add item' in the code ] - to do this i need to get a handle to the store of the grid, but i'm struggling to get the correct scope.

    Any help greatly appreciated.

    PHP Code:
    Ext.aurora.soGrid Ext.extend(Ext.grid.EditorGridPanel, {
        
    initComponent:function() {
            
    Ext.apply(this, {    
                    
    frame            false,
                    ....
                    .....             
                    
    store: new Ext.data.SimpleStore({                                            
                            
    fields: [
                               {
    name'image'},
                               {
    name'code'},
                               {
    name'quantity'},
                               {
    name'total'}
                            ]                    
                        }),
                     
                    
    cm: new Ext.grid.ColumnModel([
                            .....
                            ......
                    ]),
                    
    tbar:[
                          {
    xtype"xProductPicker"},
                          {
                                
    text"Add Item",
                                
    iconCls"add",
                                
    scopeExt.aurora.soGrid.prototype// doesn't work
                                //scope: Ext.aurora.soGrid.superclass, // doesn't work either...
                                
    handler: function(){
                                    var 
    Ext.data.Record.create([
                                        { 
    image"new image"},
                                        { 
    code"xxxx"},
                                        { 
    quantity23},
                                        { 
    total100}
                                    ]);
                                    
    this.stopEditing(); 
                                    var 
    st this.getStore(); // returns null      
                                    
    console.log(st); // null
                                    
    console.log(this); // returns what looks like the grid
                                    
    console.log(this.getStore()); // null even though i can see the method in the 'this' object in firefly
                                    
    st.insert(0p);
                                    
    this.startEditing(00);
                                }
                          }
                         ]
            }); 
    // e/o apply

            
    Ext.aurora.soGrid.superclass.initComponent.apply(thisarguments);

        } 
    // e/o function initComponent
        
    ,onRender:function() {
            
    Ext.aurora.soGrid.superclass.onRender.apply(thisarguments);
        } 
    // e/o function onRender
    });
    Ext.reg('xStockOrderGrid'Ext.aurora.soGrid); 

  2. #2
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,781
    Vote Rating
    599
    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


    You're just referencing the type, not the instance:

    Code:
    scope: this
    BTW, you don't have to provide a scope.

  3. #3
    Sencha User deccard's Avatar
    Join Date
    Jan 2008
    Location
    Chesterfield, UK
    Posts
    28
    Vote Rating
    0
    deccard is on a distinguished road

      0  

    Default


    thanks evant.

Thread Participants: 1

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