-
29 Jul 2011 12:45 PM #1
Ext.form.Fieldset inconsistent setInstructions behavior
Ext.form.Fieldset inconsistent setInstructions behavior
It's possible to set fieldset instructions to '' prior to form rendering and hide the instructions element entirely. Setting instructions to '' after render causes those elements to be created and displayed (as empty grey divs by default.)
Suggestion:
- make the empty string ('') behavior consistent pre- and post-render
- provide a mechanism - either a new method, or passing undefined, null, or false to setInstructions - clear the instructions text and remove its element entirely
-
1 Aug 2011 9:08 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,599
- Vote Rating
- 434
This override adds a new parameter for you. Not everyone would want to remove it for whatever reason but if you set that second param to true it will remove the EL if the string is empty. If you want the default to be true then just change the lineCode:Ext.override(Ext.form.FieldSet, { setInstructions: function(instructions, removeEmpty) { removeEmpty = removeEmpty || false; if (this.rendered) { if (this.instructionsEl && instructions.length == 0 && removeEmpty) { Ext.destroy(this.instructionsEl); delete this.instructionsEl; } else if (!this.instructionsEl) { this.instructionsEl = this.el.createChild({ cls: this.componentCls + '-instructions' }); } if (this.instructionsEl) { this.instructionsEl.setHTML(instructions); } } else { this.instructions = instructions; } return this; } });
toCode:removeEmpty = removeEmpty || false;
Code:removeEmpty = removeEmpty || true;
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
Thank you for reporting this bug. We will make it our priority to review this report.


Reply With Quote