Results 1 to 3 of 3

Thread: number field: problem with listener

  1. #1
    TheMonolith
    Guest

    Question number field: problem with listener

    Can somebody tell me why giving the number field the focus (e.g. by clicking on it) doesn't cause the panel with the id "testID" to become invisible (while the alert("xxx") works)?

    I highlighted the important parts of the code with blue.

    Code:
    {
        xtype: "fieldset",   
        title: "Textfarbe",
        autoHeight: true,
        layout: "column",
        items:
        [{
            xtype: "form",
            border: false,
            labelAlign: "top",
            title: "",
            width: "20%",
            labelWidth: 35,
            items:
            [{
                xtype: "numberfield",
                fieldLabel: "C",
                width: 35,
                allowDecimals: false,
                allowNegative: false,
                maxValue: "100",
                autoCreate:
                {
                    tag: 'input',
                    type: 'number',
                    name: 'state',
                    maxlength: 3
                },
                listeners: 
                {
                    focus: function()
                    {
                        Ext.getCmp('testID').setVisible('false');
                        alert("xxx");
                    }
                }
            }]
        }, 
        {
            xtype: "form",
            border: false,
            labelAlign: "top",
            title: "",
            width: "20%",
            labelWidth: 70,
            items:
            [{
                xtype: "panel",
                id: "testID",
                border: false,
                bodyStyle: 'background-color:rgb(255, 0, 255);',
                fieldLabel: "Vorschau",
                width: 40,
                height: 30
            }]
        }]
    }

  2. #2
    Sencha User
    Join Date
    Dec 2008
    Location
    France
    Posts
    321

    Default

    Have you tried :

    PHP Code:
    Ext.getCmp('testID').hide(); 
    ?

  3. #3
    Sencha User Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246

    Default

    Don't use a string when you want a boolean!

    'false' == true

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •