#20 ✓resolved
ingmars (at web)

Wires are mispositioned when using wirable fields within "group" fields

Reported by ingmars (at web) | June 26th, 2009 @ 07:04 PM

When using the "wirable" option at a sub-field of a "group" field, the wires are mispositioned (it starts very far below the actual starting point).

The same is happening when "wirable" fields are positioned within "list" fields.

Attached you'll find a full demonstration of the bug.

Comments and changes to this ticket

  • ingmars (at web)

    ingmars (at web) July 5th, 2009 @ 07:26 PM

    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)

    ingmars (at web) July 5th, 2009 @ 07:27 PM

    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)

    eric.abouaf (at gmail) July 5th, 2009 @ 08:11 PM

    • 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)

    ingmars (at web) July 5th, 2009 @ 08:37 PM

    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.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

WireIt is an open-source javascript library to create web wirable interfaces for dataflow applications, visual programming languages or graphical modeling.

The issue tracker has moved to GitHub:
http://github.com/neyric/wireit/issues

Pages