1. #1
    Sencha User viniciuscs's Avatar
    Join Date
    Jan 2012
    Location
    São Paulo / Brazil
    Posts
    8
    Vote Rating
    0
    viniciuscs is on a distinguished road

      0  

    Default Answered: How to bubble an event from Ext.data.Store ?

    Answered: How to bubble an event from Ext.data.Store ?


    I'm working on a grid panel and i need such an event that get fired after the store associated with it has finished to load the data. After tried the 'viewready', 'afterrender' and 'afterlayout' events of the panel itself with no success then i started to look on the events of the store. The 'datachanged' event is perfect and works for me but i didn't find a way to bubble it to my grid. The store has the 'enableBubble' method, but not the 'getBubbleTarget' since it doesn't inherits from Ext.AbstractComponent.

    Code:
    store: {
            fields: [ 'dom', 'seg', 'ter', 'qua', 'qui', 'sex', 'sáb' ],
            
            initComponent: function() {
                this.callParent();
                this.enableBubble('myevent');
            },
            
            getBubbleTarget: function() {
                console.log('getBubbleTarget');
                return Ext.ComponentQuery.query('mygridpanel');
            },
            
            listeners: {
                datachanged: function(store, options) {
                    this.fireEvent('myevent');
                }
            }
    }

    The "console.log('getBubbleTarget');" line on 'getBubbleTarget' method above is never reached and neither the grid listener for 'myevent'.

    Someone can tell me what am i doing wrong? Or even an event from the grid panel that works on this scenario and i haven't tested yet.

  2. No, bubbleEvents is a config of Ext.util.Observable (see code below) and this class is used as mixin in Ext.data.AbstractStore. So, it will be available with Ext.data.AbstractStore and its extendings.

    Constructor of Ext.util.Observable:
    Code:
    constructor: function(config) {
        var me = this;
    
    
        Ext.apply(me, config);
        if (me.listeners) {
            me.on(me.listeners);
            delete me.listeners;
        }
        me.events = me.events || {};
    
        if (me.bubbleEvents) {
            me.enableBubble(me.bubbleEvents);
        }
    },
    Though it also calls enableBubble() but this is called when constructing the store object in this case and before any call to enableBubble() you do with your code.

    I have tried the code I supplied in the previous post and the getBubbleTarget() was reached well. Let have a try.

  3. #2
    Sencha User viniciuscs's Avatar
    Join Date
    Jan 2012
    Location
    São Paulo / Brazil
    Posts
    8
    Vote Rating
    0
    viniciuscs is on a distinguished road

      0  

    Default


    I did noticed some mistake made on the previous post. Ext.data.Store doesn't has an 'initComponent' method so i tried to call the 'enableBubble' using a constructor as listed below but again, without success.

    Code:
    store: {
            fields: [ 'dom', 'seg', 'ter', 'qua', 'qui', 'sex', 'sáb' ],
            
            constructor: function(config) {
                var me = this;
    
    
                console.log('store constructor');
    
    
                me.callParent(arguments);
                me.initConfig(config);
                me.enableBubble('datachanged');
    
    
                return this;
            }
        }

  4. #3
    Sencha - Community Support Team
    Join Date
    Jan 2012
    Posts
    1,376
    Answers
    346
    Vote Rating
    113
    vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all

      0  

    Default


    Let have a try with bubbleEvents config.
    Code:
    store: {
            fields: [ 'dom', 'seg', 'ter', 'qua', 'qui', 'sex', 'sáb' ],
    
            bubbleEvents: ['myevent'],
    
            getBubbleTarget: function() {
                console.log('getBubbleTarget');
                return Ext.ComponentQuery.query('mygridpanel');
            },
            
            listeners: {
                datachanged: function(store, options) {
                    this.fireEvent('myevent');
                }
            }
    }

  5. #4
    Sencha User viniciuscs's Avatar
    Join Date
    Jan 2012
    Location
    São Paulo / Brazil
    Posts
    8
    Vote Rating
    0
    viniciuscs is on a distinguished road

      0  

    Default


    bubbleEvents is a config option of Ext.container.AbstractContainer and isn't available for Ext.data.Store.

  6. #5
    Sencha - Community Support Team
    Join Date
    Jan 2012
    Posts
    1,376
    Answers
    346
    Vote Rating
    113
    vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all

      0  

    Default


    No, bubbleEvents is a config of Ext.util.Observable (see code below) and this class is used as mixin in Ext.data.AbstractStore. So, it will be available with Ext.data.AbstractStore and its extendings.

    Constructor of Ext.util.Observable:
    Code:
    constructor: function(config) {
        var me = this;
    
    
        Ext.apply(me, config);
        if (me.listeners) {
            me.on(me.listeners);
            delete me.listeners;
        }
        me.events = me.events || {};
    
        if (me.bubbleEvents) {
            me.enableBubble(me.bubbleEvents);
        }
    },
    Though it also calls enableBubble() but this is called when constructing the store object in this case and before any call to enableBubble() you do with your code.

    I have tried the code I supplied in the previous post and the getBubbleTarget() was reached well. Let have a try.

  7. #6
    Sencha User viniciuscs's Avatar
    Join Date
    Jan 2012
    Location
    São Paulo / Brazil
    Posts
    8
    Vote Rating
    0
    viniciuscs is on a distinguished road

      0  

    Default


    very nice vietits, it's working now! thnks.

    Code:
    store: {
        bubbleEvents: [ 'datachanged' ],
        fields: [ 'dom', 'seg', 'ter', 'qua', 'qui', 'sex', 'sáb' ],
        
        getBubbleTarget: function() {
            return Ext.ComponentQuery.query('mypanel')[0];
        }
    },
    
    
    listeners: {
        datachanged: function(store, options) {
            console.log('works now');
        }
    }
    By the way, i'm using your 'Its.grid.column.Component' in this grid i'm working on to render panels inside the cells. And this thread had started because i want to set the height of the panels (consequently the rows) to fill all available space in the grid. This grid will have a variable but limited number of rows ( 4-6 ). Do you know an easier way to achieve this? thks one more time.

  8. #7
    Sencha - Community Support Team
    Join Date
    Jan 2012
    Posts
    1,376
    Answers
    346
    Vote Rating
    113
    vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all

      0  

    Default


    Hi viniciuscs,

    I am sorry. I have no solution for your question right now.

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..." hd porno faketaxi