Skip to content

Select api & update json based on schema of item returned #802

Closed
@tkuben

Description

@tkuben

Hi All,

I would like to have an enumSource reference an API which pulls the list of items. Each item in the list contains a schema of its own. Upon change, I would like to append to the select box, the schema that they have chosen to allow the user to enter values for it. I have updated my jsoneditor code with the following pull request: #720 and made my own changes. Now, on the onChange portion of the select, I have the following:

onInputChange: function() {
  var val = this.input.value;

  var editor = this.jsoneditor.getEditorClass(this.enumSource[0].source[val].schema);

  var ret = this.jsoneditor.createEditor(editor,{
    jsoneditor: this.jsoneditor,
    schema: this.enumSource[0].source[val].schema,
    container: this.container,
    path: this.path,
    parent: this
  });
  ret.preBuild();
  ret.build();
  ret.postBuild();

This successfully pulls the schema of the item and appends to the select box, however it is not updating the global json editor with the new schema I've added. It only contains the select box but not the item I have chosen. How can I register this such that the item's schema I have selected is also included into the global schema?

Thank you
Cheers,
TJ

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions