jdorn / json-editor

JSON Schema Based Editor
MIT License
5.8k stars 1.08k forks source link

dynamic title for arrays #497

Open simevo opened 9 years ago

simevo commented 9 years ago

Hi thanks for the excellent library. Is there a way to have dynamic title for the array ? That would be useful when the array is collapsed, to know whether it contains any item or how many. In your Children array of Child objects you show how headerTemplate can be used to make the items title dynamic. I have tried this on the Children array:

{
  "type": "array",
  "title": "Children",
  "headerTemplate": "Children {{ self.items.length }}",
  "items": {
    "type": "object",
    "title": "Child",
    "headerTemplate": "{{ i1 }} - {{ self.name }} (age {{ self.age }})",
    "properties": {
      "name": { "type": "string" },
      "age": { "type": "integer" }
    }
  }
}

but it does not seem to work. Am I using an incorrect synthax or is this a missing feature ? Paolo

L2o commented 8 years ago

Hi, I'm having the same issue, any ideas ? Thanks. Léo