PDA

View Full Version : How to show&hide of Label of textfield correctly?



xjtumalin
18 Nov 2009, 10:13 PM
Hi, guys

I set up a textfield and it's label as invisible by

{
xtype: 'textfield',
id:'inst_contactor',
hidden:true,
hideLabel:true,
fieldLabel: 'Contactor',
allowBlank:false
}

When I try to show this textfield by
Ext.getCmp('inst_contactor').setVisible(true);

textfield showed up, but label is still invisible.

How can I show the label?

Thanks.

Condor
19 Nov 2009, 1:54 AM
Use the code from this post (http://www.extjs.com/forum/showthread.php?p=120152#post120152).

Animal
19 Nov 2009, 2:44 AM
Surely, that's not necessary in Ext 3?

You configure the FormLayout with trackLabels: true

and then hiding/showing the Field will hide and show the label too.

(Or is that code not released yet?)

Condor
19 Nov 2009, 2:51 AM
The linked post contains separate overrides for Ext 2.x, Ext 3.0.0 and Ext 3.0.1+ (using trackLabels).

mysticav
19 Dec 2009, 4:08 PM
According to Ext 3.1 changeLog:

* Several modifications to fix issues with form layout:
o Added the ability to hide and show field labels with the Field
o Added new template methods for when an item is added to and removed from a Container
o Added a method to allow layouts to clean up after themselves
o Form layouts can now be dynamic (moving fields to another form)
[/QUOTE]

Can somebody tell me how to use this new feature ?

I've been waiting this feature since 1.x
I'm of those who think this should be the default behavior, because I'm don't see any reason hiding the field and keeping the label.

Animal
20 Dec 2009, 1:06 AM
http://www.extjs.com/deploy/dev/docs/?class=Ext.layout.FormLayout&member=trackLabels

mysticav
12 Jan 2010, 12:36 AM
The combo is not rendered correctly using trackLabels (in Google Chrome). When I show the combo (after been initially hidden) this is how it is shown (see attachment).

I hope the Ext team take a look to this problem.

Condor
12 Jan 2010, 12:50 AM
You probably need to set hideMode:'offsets'.

metra
22 Apr 2010, 8:38 AM
Thank you condor! hideMode:'offsets' fixed my Google Chrome problem.

There should be a way to upvote helpful threads/posts.