json-schema-form / angular-schema-form

Generate forms from a JSON schema, with AngularJS!
https://json-schema-form.github.io/angular-schema-form
MIT License
2.47k stars 653 forks source link

Hide/Disable Add and Remove buttons from TabArray #791

Closed karthiks3000 closed 8 years ago

karthiks3000 commented 8 years ago

Enhancement

As a developer, I would like to use the tabarray option to provide a read-only view of my array. But I can't seem to find a way to remove the Add and Remove buttons. Setting Add and Remove to null works when the type is just an array but not when the type is set to 'tabarray'

Sample

I have modified the tab array sample from the schema-form demo page, is this feature not there yet or am I doing something wrong??

[http://schemaform.io/examples/bootstrap-example.html]

[
  {
    "type": "help",
    "helpvalue": "<h4>Tabbed Array Example</h4><p>Tab arrays can have tabs to the left, top or right.</p>"
  },
  {
    "key": "comments",
    "type": "tabarray",
    "add": null,
    "remove": null,
    "style": {
      "remove": "btn-danger"
    },
    "title": "{{ value.name || 'Tab '+$index }}",
    "items": [
      "comments[].name",
      "comments[].email",
      {
        "key": "comments[].comment",
        "type": "textarea"
      }
    ]
  },
  {
    "type": "submit",
    "style": "btn-default",
    "title": "OK"
  }
]

@json-schema-form/angular-schema-form-lead

joelwkent commented 8 years ago

Hi @karthiks3000, this functionality is included in the latest ASF bootstrap decorator but it may be that the latest decorator is not being used in the examples on Schemaform.io . If you pull the latest code it should work for you. I just checked the code here and the add/remove buttons will not exist if the tabArray is read-only or the add remove attributes are set to null.

karthiks3000 commented 8 years ago

Hi @joelwkent, Thanks for the quick response!! I made the changes to my file and it worked like a charm!!

Thanks again!! You guys are awesome!!

joelwkent commented 8 years ago

Hi @karthiks3000 really happy to hear you got it sorted.