ngFormBuilder icon indicating copy to clipboard operation
ngFormBuilder copied to clipboard

[QUESTION] Can I add new keys to components?

Open sofiaisreis opened this issue 5 years ago • 1 comments

Hello, I am trying to add to specific things, in a component. 1 - First, on the values, besides 'Label' and 'Value': The value needs to be a number, not a string. Also, I need to have two fields such as 'NA', and 'Set to 0' (the second one will force the value of that row to be always 0). 2 - Secondly, I would like to add a weight option (numeric), below "Values".

exformio

The image above illustrates what I want to do. However I tried but couldn't figure out how to do it. I'm using the builder with the angular framework, and typescript instead of javascript. I'm using formoptions to acess and edit wich values I want to ignore or use, but how can I add new custom ones?

This is part of my html:

       <form-builder [form]="form" id="formBuilder" (change)="onChange($event) 
      [options]="formOptions"  [editForm]="editForm">
        </form-builder>

And my typescript code, to edit the radio component modal is:

this.formOptions = {
  editForm: {
    radio: [
          {
            key: 'display',
            ignore: 'false',
            components:
              [
                {
                  key: 'labelPosition',
                  ignore: true
                },
                {
                  key: 'optionsLabelPosition',
                  ignore: true
                },
                {
                  key: 'description',
                  ignore: true
                },
                {
                  key: 'customClass',
                  ignore: true
                },
                {
                  key: 'tabindex',
                  ignore: true
                },
                {
                  key: 'inline',
                  ignore: true
                },
                {
                  key: 'hidden',
                  ignore: true
                },
                {
                  key: 'hideLabel',
                  ignore: true
                },
                {
                  key: 'autofocus',
                  ignore: true
                },
                {
                  key: 'disabled',
                  ignore: true
                },
                {
                  key: 'tableView',
                  ignore: true
                },
                {
                  key: 'modalEdit',
                  ignore: true
                },
                {
                  key: 'customDefaultValue',
                  ignore: true
                }
              ]
          },
          {
            key: 'data',
            ignore: false,
            components:
              [
                {
                  key: 'values',
                  ignore: false,
                  components:
                    [
                      {
                        key: 'shortcut',
                        ignore: true
                      }
                    ]
                },
                {
                  key: 'defaultValue',
                  ignore: true
                },
                {
                  key: 'persistent',
                  ignore: true
                },
                {
                  key: 'protected',
                  ignore: true
                },
                {
                  key: 'dbIndex',
                  ignore: true
                },
                {
                  key: 'encrypted',
                  ignore: true
                },
                {
                  key: 'redrawOn',
                  ignore: true
                },
                {
                  key: 'defaultValue',
                  ignore: true
                },
                {
                  key: 'clearOnHide',
                  ignore: true
                },
                {
                  key: 'customDefault',
                  ignore: true
                }, {
                  key: 'customDefaultValue',
                  ignore: true
                },
                {
                  key: 'calculateValue',
                  ignore: true
                },
                {
                  key: 'calculateServer',
                  ignore: true
                },
                {
                  key: 'allowManualOverride',
                  ignore: true
                },
                {
                  key: 'dataType',
                  ignore: true
                },
                {
                  key: 'inline',
                  ignore: true
                },
                {
                  key: 'allowCalculateOverride',
                  ignore: true
                },
                {
                  key: 'defaultValueComponent',
                  ignore: true
                }
              ]
          },
          {
            key: 'layout',
            ignore: true
          },
          {
            key: 'conditional',
            ignore: true
          },
          {
            key: 'api',
            ignore: true
          },
          {
            key: 'logic',
            ignore: true
          },
          {
            key: 'validation',
            ignore: true
          }
        ]
  }
}

sofiaisreis avatar Jun 02 '20 16:06 sofiaisreis

Hello @sofiaisreis we would be happy to help you review this code as part of a support package. If you are interested in going down this road please write to [email protected] and I can discuss the options we have in place.

cmcortez avatar Jun 17 '20 13:06 cmcortez