1. #1
    Sencha User
    Join Date
    Aug 2012
    Location
    Zurich
    Posts
    5
    Vote Rating
    0
    amanyosa is on a distinguished road

      0  

    Default Unanswered: Specify listeners on child components

    Unanswered: Specify listeners on child components


    Checking on the documentation, about formpanel

    http://docs.sencha.com/touch/2-0/#!/api/Ext.form.Panel

    I've found how to supposedly specify listeners on its child components, like this


    var form =Ext.create('Ext.form.Panel',{ listeners:{'> field':{ change:function(field, newValue, oldValue){ ed.set(field.getName(), newValue);}}}, items://as before});but for me does not work (with Sencha 2.1)

    Anybody has experience with this? Could you explain what exactly means the line '> field': ?

    Thanks in advance!

  2. #2
    Sencha User bluehipy's Avatar
    Join Date
    Mar 2010
    Location
    Romania
    Posts
    612
    Vote Rating
    28
    Answers
    67
    bluehipy will become famous soon enough bluehipy will become famous soon enough

      0  

    Default


    Quote Originally Posted by amanyosa View Post
    Checking on the documentation, about formpanel

    http://docs.sencha.com/touch/2-0/#!/api/Ext.form.Panel

    I've found how to supposedly specify listeners on its child components, like this


    var form =Ext.create('Ext.form.Panel',{ listeners:{'> field':{ change:function(field, newValue, oldValue){ ed.set(field.getName(), newValue);}}}, items://as before});but for me does not work (with Sencha 2.1)

    Anybody has experience with this? Could you explain what exactly means the line '> field': ?

    Thanks in advance!

    > field is a selector for the first child of type field, post your code for directions

  3. #3
    Sencha User
    Join Date
    Aug 2012
    Location
    Zurich
    Posts
    5
    Vote Rating
    0
    amanyosa is on a distinguished road

      0  

    Default


    I don't have any code, I just tried the example from the Sencha docs and does not work...

  4. #4
    Sencha - Services Team AndreaCammarata's Avatar
    Join Date
    Jun 2009
    Posts
    1,395
    Vote Rating
    23
    Answers
    148
    AndreaCammarata has a spectacular aura about AndreaCammarata has a spectacular aura about

      0  

    Default


    You need to set the "delegate" config to "field" inside the listeners node:

    Code:
    ...
    listeners: {
        delegate: 'field',
        change: function(field, newValue, oldValue){
             console.log(newValue);
        }
     }
    You can read more on event delegation at the following doc page:
    http://docs.sencha.com/touch/2-1/#!/...able-method-on
    Sencha Inc
    Andrea Cammarata, Solutions Engineer
    Owner at SIMACS

    @AndreaCammarata
    www.andreacammarata.com
    github: https://github.com/AndreaCammarata

    TUX components bundle for Sencha Touch 2.x.x
    https://github.com/AndreaCammarata/TUX


Thread Participants: 2

Tags for this Thread