Wires are mispositioned when using wirable fields within "group" fields
-
ingmars (at web)
Here's a solution for the mentioned bug (maybe not the most elegant one, but at least it works.)
The problem was, that the wirable sub fields didn't have a back reference to their containers any more. Therefore, they didn't "know" at what point to stop adding up the top / left offsets and just calculated all the way done to the body element.
It did work for fields on the first level, but not for sub fields.
Solution: Just set the options.container property for sub fields of group of list fields as well.
===============================================================================
In the file js/util/inputex/FormContainer-beta.js replace the method renderForm with
the following two methods:/**
* Render the form * @method renderForm */renderForm: function() {
this.setBackReferenceOnFieldOptionsRecursively(this.options.fields); var groupParams = {parentEl: this.bodyEl, fields: this.options.fields, legend: this.options.legend, collapsible: this.options.collapsible}; this.form = new YAHOO.inputEx.Group(groupParams);},
setBackReferenceOnFieldOptionsRecursively: function(fieldArray) {
for(var i = 0 ; i < fieldArray.length ; i++) { var inputParams = fieldArray[i].inputParams; inputParams.container = this; // Checking for group sub elements if(inputParams.fields && typeof inputParams.fields == 'object') { this.setBackReferenceOnFieldOptionsRecursively(inputParams.fields); } // Checking for list sub elements if(inputParams.elementType) { inputParams.elementType.inputParams.container = this; // Checking for group elements within list elements if(inputParams.elementType.inputParams.fields && typeof inputParams.elementType.inputParams.fields == 'object') { this.setBackReferenceOnFieldOptionsRecursively(inputParams.elementType.inputParams.fields); } } }},
===============================================================================
-
ingmars (at web)
Once again, now nicer to read (hopefully!)
In the file js/util/inputex/FormContainer-beta.js replace the method renderForm with
the following two methods:/** * Render the form * @method renderForm */ renderForm: function() { this.setBackReferenceOnFieldOptionsRecursively(this.options.fields); var groupParams = {parentEl: this.bodyEl, fields: this.options.fields, legend: this.options.legend, collapsible: this.options.collapsible}; this.form = new YAHOO.inputEx.Group(groupParams); }, setBackReferenceOnFieldOptionsRecursively: function(fieldArray) { for(var i = 0 ; i < fieldArray.length ; i++) { var inputParams = fieldArray[i].inputParams; inputParams.container = this; // Checking for group sub elements if(inputParams.fields && typeof inputParams.fields == 'object') { this.setBackReferenceOnFieldOptionsRecursively(inputParams.fields); } // Checking for list sub elements if(inputParams.elementType) { inputParams.elementType.inputParams.container = this; // Checking for group elements within list elements if(inputParams.elementType.inputParams.fields && typeof inputParams.elementType.inputParams.fields == 'object') { this.setBackReferenceOnFieldOptionsRecursively(inputParams.elementType.inputParams.fields); } } } }, -
eric.abouaf (at gmail)
- State changed from new to resolved
Thanks a lot for this fix ! This works perfectly.
It even works for more field than group and list.It has been commited on the github repository
-
ingmars (at web)
Cool, thanks for committing!
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
