Results 1 to 3 of 3

Thread: [CLOSED]Hiding form elements doesn't work correctly

    Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Ext User zhegwood's Avatar
    Join Date
    Dec 2007
    Location
    Boulder, CO Suburbia (Lafayette)
    Posts
    388

    Default [CLOSED]Hiding form elements doesn't work correctly

    Ext version tested:
    • Ext 3.1.1


    Adapter used:
    • ext


    css used:
    • only default ext-all.css




    Browser versions tested against:
    • FF3 (firebug 1.3.0.10 installed)


    Operating System:
    • Windows Vista


    Description:
    • Calling hide() on a form item only hides the element and not the label. Prior to Ext 3 calling hide on a form item would hide the entire thing.


    Test Case:

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html>
    <head>
    	<title>Test</title>
    	<script type="text/javascript" src="ext-3.1.1/adapter/ext/ext-base-debug.js"></script>
    	<script type="text/javascript" src="ext-3.1.1/ext-all-debug.js"></script>
    	<link rel="stylesheet" href="ext-3.1.1/resources/css/ext-all.css"type="text/css" />
    </head>
    <body></body>
    </html>
    <script type="text/javascript">
        Ext.onReady(function(){
        Ext.QuickTips.init();
        Ext.namespace("AV");
        AV.ViewPort = new Ext.Viewport({
          layout: "fit",
          items: new Ext.form.FormPanel({
            items: [
              new Ext.form.TextField({
                id: "textfield",
                fieldLabel: "Awesome",
                //hidden: true //this also only hides the form field and not the label
              }),
              new Ext.Button({
                text: "hide it",
                listeners: {
                  click: function() {
                    Ext.getCmp("textfield").hide();
                  }
                }
              })
            ]
          })
      });
    });
    </script>
    See this URL : http://


    Steps to reproduce the problem:
    • Create an html page with the code above


    The result that was expected:
    • clicking the button hides the entire form element, not just the input


    The result that occurs instead:
    • clicking the button hides only the input and not the label


    Screenshot or Video:
    • attached


    Debugging already done:
    • none


    Possible fix:
    • This is what I've been doing, but it won't work if the fields aren't in a form layout
      Code:
      listeners: {
        render: function(obj) {
          var ct = obj.el.up('.x-form-item');
          ct.setStyle("display","none");
        },
        scope: this
      }

  2. #2
    Sencha Premium User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,258

    Default

    Actually the default behaviour has never been to hide labels, perhaps you were using a custom override.

    Anyway, this behaviour now exists in 3.1+, http://www.extjs.com/deploy/dev/docs...er=trackLabels

    Marking as closed.
    Twitter - @evantrimboli
    Former Sencha framework engineer, available for consulting.
    As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.

  3. #3
    Ext User zhegwood's Avatar
    Join Date
    Dec 2007
    Location
    Boulder, CO Suburbia (Lafayette)
    Posts
    388

    Default

    Weird, yeah must have been. Hmm. Thanks for the response Re: trackLabels. Works like a champ!

Posting Permissions

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