-
5 Sep 2008 12:37 AM #1
How to hide a textfield
How to hide a textfield
Hi,
I have a textfield in a panel :
I would like to hide this textfield so I do something like that :Code:xtype: 'textfield', fieldLabel: 'Research', id: 'searchedValue'
-> The field is not visible any more but the label is still visible ("Research") !Code:Ext.getCmp('searchedValue').hide();
How could I hide this label ?
Thank you...
-
5 Sep 2008 12:56 AM #2
-
5 Sep 2008 12:57 AM #3
-
5 Sep 2008 12:58 AM #4
See at two config options of Class Ext.form.TextField
- inputType : String
Code:The type attribute for input fields -- e.g. radio, text, password, file (defaults to "text"). The types "file" and "password" must be used to render those field types currently -- there are no separate Ext components for those. Note that if you use inputType:'file', emptyText is not supported and should be avoided.
- hideLabel : Boolean
Code:True to completely hide the label element (defaults to false)
I'm sure one of them will be helpful for you.
- inputType : String
-
5 Sep 2008 1:09 AM #5
The problem is that I want the label being visible when the field is visible and hide the label just when I hide the field (by clicking a button for exemple).
I also tried :
but I have the same problem : the label is still visible !Code:Ext.getCmp('searchedValue').destroy()
-
5 Sep 2008 1:19 AM #6
what i did when i wanted to hide the whole field (label & input) was to get the field via Ext.get() and then move up the dom to the 2nd parent of the field (the div that contains both):
Ext.get( FormField ).parent().parent().setStyle( 'display', 'none' );
maybe there's a better way, but this always worked for me, since i wanted the dom block "removed" so elements below it move up... if you want to show it again just set display back to 'block'


Reply With Quote