-
2 Apr 2008 11:30 PM #11
Ohw, I'm glad to find this post.
I'm passing by it right now using Ext 2.0.2 version. I destroy the field but the label remains.
This fix is already on SVN or who wants to destroy/hide a form field do better overriding the FormLayout?
Maybe is time to open a "bug by omission" ticket?
ps. Thanks Animal!Mandriva Linux in
LAMPE (Linux / Apache / MySQL / PHP / ExtJs)
-
3 Apr 2008 12:21 AM #12
No, Jack has not changed the FormLayout class. I assume there must be a reason for this.
Search the forum: http://www.google.com/coop/cse?cx=01...%3Az7of1ufqccu
Read the docs too: http://extjs.com/deploy/dev/docs/
Scope: http://extjs.com/forum/showthread.ph...642#post257642
-
3 Apr 2008 1:22 AM #13
Unfortunately we can't make this change because it is not backwards compatible and might not be desirable in some scenarios.
For example, I recently did a services project where we had a form with 2 modes, editable and non-editable. When non-editable, the fields were displayed as text and when editable they were a field. When switching between the 2 views, fields were destroyed and the text was again created. The labels and remaining markup always remained.
I do however agree that an easier method of adding a removing fields, including labels, is needed. The solution may be in the field class itself, with a destroy (or beforedestroy) handler which does an up() call and removes undesired markup. The same can be applied to hide. Maybe implemented as a simple plugin?
-
3 Apr 2008 5:46 AM #14
A mode flag for fields? actionMode: 'field' or actionMode:'wrapper'.
Possibly actionMode:Ext.form.Field.FIELD or actionMode:Ext.form.Field.WRAPPER
This could be a config of FormLayout, and could make both showing/hiding and destroying use the wrapper instead of the contained field.Search the forum: http://www.google.com/coop/cse?cx=01...%3Az7of1ufqccu
Read the docs too: http://extjs.com/deploy/dev/docs/
Scope: http://extjs.com/forum/showthread.ph...642#post257642
-
3 Apr 2008 6:41 AM #15Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- The Netherlands
- Posts
- 24,251
- Vote Rating
- 44
That works for hiding and disableing fields, but not for destroying fields (Ext.Component.destroy() only checks for actionMode == "container").
-
24 Apr 2008 7:49 AM #16
Hi, I'm using that override but I passing by another problem.
If I create a textfield (or any other) with disabled:true when I do a .enable() the field enables but x-item-disabled css remains on the field letting it grayed. There is a tune to this override to fix that or I'll need to take x-item-disabled out by hand?
Thanks!Mandriva Linux in
LAMPE (Linux / Apache / MySQL / PHP / ExtJs)
-
11 May 2008 12:21 AM #17
I was having this problem and used the override. When I did something like:
myPanel.cascade(function(cmp){ if(cmp.isFormField) myPanel.remove(cmp,true);});
I was getting a some Container C[T] error...
Then I switched to something like:
myPanel.cascade(function(cmp){if(cmp.isFormField) cmp.destroy();});
This removed the items from rendering on the panel, but the objects still existed in the myPanel.items.items array... and whenever I would call cascade on the panel, those components would be passed in.
In my case, it was okay to add another container to the panel, so now I just create a FieldSet, populate that with my form fields and then add/remove the FieldSet from myPanel. This works.... but if there is something I'm missing or a better way to do things, please let me know. Thanks!
-
12 May 2008 8:24 AM #18
If the element that is being hidden is inside a fieldSet, how do you make the fieldset resize to not have empty space where the form element was located.
If I destroy the element, the fieldset shrinks and there is no empty space.
-
12 May 2008 9:27 AM #19
-
27 May 2008 5:54 AM #20
Any news on making this part of the ext code in some kind of ways? The override seems to work fine for me, but I always like to avoid override of the core code...
Thanks
Seb



Reply With Quote