question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How can I auto-complete the field of an array element?

See original GitHub issue

General information

I followed this wiki to get auto-complete working on a simple object field at the top of my schema.

Now I’m trying to do the same for a field of an array object and I cannot get it working. Also, I couldn’t find any solutions online.

  • json-editor version: 1.3.5

Imagine the following schema:

{
  "title": "Store",
  "type": "object",
  "properties": {
    "name": {
      "type": "string"
    },
    "city": {
      "type": "string"
    },
    "products": {
      "type": "array",
      "items": { 
        "type": "object",
        "properties": {
          "name": {"type": "string"},
          "price": {"type": "number"}
        }
      }
    }
  }
}

I am able to autocomplete the store name, but I don’t know how to proceed with the product name.

Do you have an example?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6

github_iconTop GitHub Comments

2reactions
pmk65commented, May 8, 2019

@pauldamian I would do it like this: https://is.gd/Vg65xR The “ready” event is used for attaching the handler to the static fields and the “change” event loops through the editors and attach the handler to the dynamic array elements.

When you “watch” an editor, the event is first triggered AFTER you exit focus on the field, so that’s why your code doesn’t work as expected.

0reactions
pauldamiancommented, Jun 18, 2019

Thanks, @pmk65, really appreciate it!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How To Create Autocomplete on an Input Field
Step 5) Initiate the Autocomplete Effect on "myInput": Example. Pass the countries array as the second parameter of the autocomplete function: <script>
Read more >
JQuery Autocomplete using array as source should display ...
I am using Jquery autocomplete and array as source and I want to display the label instead of the value because i am...
Read more >
Filtering and Selection of AutoComplete for a field ...
I am have data like following: {. companyname:'',. locations:[ {address: 'address1', city:'city1', state:'state1'},.
Read more >
Atlas Search Autocomplete on an array of object
You can use the autocomplete type to index string fields inside an array of documents indexed as the embeddedDocuments type.
Read more >
Autocomplete value to array
I would like to use the “AutoComplete” on the “Video” form to select one category and then store it on a Array, if...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found