1. #1
    Ext User
    Join Date
    Jul 2008
    Posts
    19
    Vote Rating
    0
    Sandrine is on a distinguished road

      0  

    Default Write text in another tab by clicking on combobox

    Write text in another tab by clicking on combobox


    Hi all,

    I need some help.

    I have a modal window, separate in two parts.
    Left : my store in combobox.
    Center : three tabs.
    When i choose one thing in my combobox i want to write a text in my first tab.
    You know what i mean?
    Code:
        var store = new Ext.data.SimpleStore({
            fields: [ 'state'],
            data : exampleData
        });
        var combo = new Ext.form.ComboBox({
            store: store,
            displayField:'state',
            typeAhead: true,
            mode: 'local',
            emptyText:'Selection...',
            selectOnFocus:true
           ,listeners:{select:{fn:function(combo, value) {
                            alert( combo.getValue());
                            genre.body.update('some text');//genre -> first tab's id 
                            }}
                        }
    
        });
    How can i do that?
    IF you have idea... Thanks
    Sandrine
    Last edited by evant; 29 Jul 2008 at 1:47 AM. Reason: Code goes in [code][/code] tags, see: http://extjs.com/forum/misc.php?do=bbcode

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


    That looks like the right way to go about it, what's the problem?
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  3. #3
    Ext User
    Join Date
    Jul 2008
    Posts
    19
    Vote Rating
    0
    Sandrine is on a distinguished road

      0  

    Default snif

    snif


    It's written :
    genre.body is undefined .
    Sniff

  4. #4
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    17,018
    Vote Rating
    650
    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


    Ok, well you can't just treat a string as though it's a variable.

    You need to either
    a) Keep a reference to the tab when you create it
    b) Use Ext.getCmp() to retrieve the component instance
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  5. #5
    Ext User
    Join Date
    Jul 2008
    Posts
    19
    Vote Rating
    0
    Sandrine is on a distinguished road

      0  

    Default


    alert( combo.getValue()); => it works
    alert( Ext.getCmp('combo').getValue()); =>it doesnt work

    Ext.getCmp("combo") is undefined

    Did i forget something?

  6. #6
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    17,018
    Vote Rating
    650
    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


    Wrong thing.

    combo is a valid variable. genre is not, that's where you need getCmp. I'd suggest you read the documentation to understand why you need to do that.
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  7. #7
    Ext User
    Join Date
    Jul 2008
    Posts
    19
    Vote Rating
    0
    Sandrine is on a distinguished road

      0  

    Default


    Ok thanks i'm going to read right now.

Thread Participants: 1