Wait! Looks like we don't have enough information to add this to bug database. Please follow this template bug format.
  1. #1
    Sencha User
    Join Date
    Mar 2009
    Posts
    227
    Vote Rating
    0
    SchattenMann is an unknown quantity at this point

      0  

    Default Formpanel Events don't work when using itemID/delegate

    Formpanel Events don't work when using itemID/delegate


    i've noticed the following:

    events work if i don't set a itemId

    Code:
    Ext.define('PrimaveraWebUI.view.EditorCabecDoc', {
        extend: 'Ext.form.Panel',
        alias: 'widget.editorcabecdoc',
    
        config: {
            items: [],
            listeners: [
                {
                    fn: 'onCabecDocActivate',
                    event: 'activate'
                }
            ]
        },
    
        onCabecDocActivate: function(container, newActiveItem, oldActiveItem, options) {
            console.debug('nice');
        }
    
    });
    but if i set a itemId no event will work

    Code:
    Ext.define('PrimaveraWebUI.view.EditorCabecDoc', {
        extend: 'Ext.form.Panel',
        alias: 'widget.editorcabecdoc',
    
        config: {
            itemId: 'cabecdoc',
            items: [],
            listeners: [
                {
                    fn: 'onCabecDocActivate',
                    event: 'activate',
                    delegate: '#cabecdoc'
                }
            ]
        },
    
        onCabecDocActivate: function(container, newActiveItem, oldActiveItem, options) {
            console.debug('nice');
        }
    
    });
    i've tried with random itemID values so there is no way this is some conflict.

    also i've searched in the HTML code for "CabecDoc" (my itemID) and it doesn't exist anywhere so i guess this values is not being passed to the HTML

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,347
    Vote Rating
    846
    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


    Have you tried using the control config on Ext.Container and it's subclasses?
    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.

  3. #3
    Sencha User
    Join Date
    Mar 2009
    Posts
    227
    Vote Rating
    0
    SchattenMann is an unknown quantity at this point

      0  

    Default


    i've tried it now with same result, event not fired.

    Code:
    Ext.define('PrimaveraWebUI.controller.Navegador', {
        extend: 'Ext.app.Controller',
        config: {
            refs: {
                Stage: 'stage',
                EditorVendas: 'stage editorvendas',
                EditorVendasToolbar: 'editorvendas toolbar'
            },
    
            control: {
                "CabecDoc": {
                    activate: 'onFormpanelActivate'
                }
            }
        },
    
        onFormpanelActivate: function(container, newActiveItem, oldActiveItem, options) {
            console.deubg ('buh');
        }
    
    });

  4. #4
    Sencha User
    Join Date
    Mar 2009
    Posts
    227
    Vote Rating
    0
    SchattenMann is an unknown quantity at this point

      0  

    Default


    i forgot to mention i'm using Designer so i believe i can't do that...or at least i don't know how

    also this doesn't seem to happen with every container.

    if i do it with a button it works perfectly, same with a navigation view.

    that's confusing

  5. #5
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,347
    Vote Rating
    846
    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


    I meant control on the form panel:

    Code:
    Ext.define('MyForm', {
        extend : 'Ext.form.Panel',
        xtype : 'myform',
    
        config : {
            ....
            control : {....}
        }
    });
    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.

  6. #6
    Sencha User
    Join Date
    Mar 2009
    Posts
    227
    Vote Rating
    0
    SchattenMann is an unknown quantity at this point

      0  

    Default


    PS: no idea how but my post ended up before yours O.o

  7. #7
    Sencha User
    Join Date
    Mar 2009
    Posts
    227
    Vote Rating
    0
    SchattenMann is an unknown quantity at this point

      0  

    Default


    thanks for the reply.

    as i said this is not happening me with buttons.

    i'm using a lot of button tap events with no problems whatsoever.

    FormPanel was the first time i had a problem...

    you can replicate a working tab activate event with itemId defined?

  8. #8
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,347
    Vote Rating
    846
    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


    Quote Originally Posted by SchattenMann View Post
    PS: no idea how but my post ended up before yours O.o
    That happens if you reply too fast, seems to be a server time issue... happens to me all the time. Here is a test application to show itemId working from Controller and the Form:

    Code:
    Ext.define('Test.controller.Main', {
        extend : 'Ext.app.Controller',
    
        config : {
            control : {
                'myform #submit' : {
                    tap : 'onButtonTap'
                }
            }
        },
    
        onButtonTap : function() {
            console.log('button tap fired from controller');
        }
    });
    
    Ext.define('Test.view.MyForm', {
        extend : 'Ext.form.Panel',
        xtype  : 'myform',
    
        config : {
            items : [
                {
                    xtype : 'textfield',
                    label : 'One'
                },
                {
                    xtype  : 'button',
                    text   : 'Submit',
                    ui     : 'confirm',
                    itemId : 'submit'
                }
            ],
    
            control : {
                '#submit' : {
                    tap : 'onButtonTap'
                }
            }
        },
    
        onButtonTap : function() {
            console.log('button tap fired from view');
        }
    });
    
    Ext.application({
        name : 'Test',
    
        controllers : ['Main'],
    
        launch : function () {
    
            new Test.view.MyForm({
                fullscreen : true
            });
    
        }
    });
    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.

  9. #9
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,347
    Vote Rating
    846
    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


    Something like this?

    Code:
    Ext.define('Test.controller.Main', {
        extend : 'Ext.app.Controller',
    
        config : {
            control : {
                'mytab #one' : {
                    activate : 'onOneActivate'
                },
                'mytab #two' : {
                    activate : 'onTwoActivate'
                }
            }
        },
    
        onOneActivate : function() {
            console.log('one activate from controller');
        },
    
        onTwoActivate : function() {
            console.log('two activate from controller');
        }
    });
    
    Ext.define('Test.view.MyTab', {
        extend : 'Ext.tab.Panel',
        xtype  : 'mytab',
    
        config : {
            items : [
                {
                    title  : 'One',
                    html   : 'one',
                    itemId : 'one'
                },
                {
                    title  : 'Two',
                    html   : 'two',
                    itemId : 'two'
                }
            ],
    
            control : {
                '#one' : {
                    activate : 'onOneActivate'
                },
                '#two' : {
                    activate : 'onTwoActivate'
                }
            }
        },
    
        onOneActivate : function() {
            console.log('one activate from view');
        },
    
        onTwoActivate : function() {
            console.log('two activate from view');
        }
    });
    
    Ext.application({
        name : 'Test',
    
        controllers : ['Main'],
    
        launch : function () {
    
            new Test.view.MyTab({
                fullscreen : true
            });
    
        }
    });
    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.

  10. #10
    Sencha User
    Join Date
    Mar 2009
    Posts
    227
    Vote Rating
    0
    SchattenMann is an unknown quantity at this point

      0  

    Default


    yes

    tried both with control and events.

    i've just create a new clean project under Designer to make sure it wasn't some mistake i've made somewhere and same behavior...everything works until i set an itemId

    Code:
    Ext.define('MyApp.view.MyTabPanel', {
        extend: 'Ext.tab.Panel',
    
        config: {
            items: [
                {
                    xtype: 'formpanel',
                    title: 'MyFormPanel',
                    itemId: 'test'
                },
                {
                    xtype: 'formpanel',
                    title: 'MyFormPanel1'
                }
            ],
            listeners: [
                {
                    fn: 'onTabpanelActivate',
                    event: 'activate',
                    delegate: '#test'
                }
            ]
        },
    
        onTabpanelActivate: function(container, newActiveItem, oldActiveItem, options) {
            console.debug('worked');
        }
    
    });
    did your code worked?
    Last edited by SchattenMann; 9 Apr 2012 at 9:05 AM. Reason: mistake on code

Thread Participants: 1