Skip to content

Using nested widgets #492

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
artur-code opened this issue Feb 27, 2017 · 7 comments
Closed

Using nested widgets #492

artur-code opened this issue Feb 27, 2017 · 7 comments

Comments

@artur-code
Copy link

artur-code commented Feb 27, 2017

Prerequisites

  • I use in my project react-jsonschema-form. I have a question.

Can I use such that UI schemes ? :

const uiSchema = {
  activities: {
    "ui:field": CustomParentComponent,
    // note the "items" for an array
    items: {
      requests: {
        "ui:field": CustomChildComponent,
      }
    }
  }
};

When I try to code such a scheme, is drawn only CustomParentComponent.
I want to draw one component inside another component.

@n1k0
Copy link
Collaborator

n1k0 commented Feb 27, 2017

What is that requests? Have you tried this?

const uiSchema = {
  activities: {
    "ui:field": CustomParentComponent,
    items: {
      "ui:field": CustomChildComponent,
    }
  }
};

Edit: here's a way to achieve what you're after. Closing.

@n1k0 n1k0 closed this as completed Feb 27, 2017
@n1k0
Copy link
Collaborator

n1k0 commented Feb 27, 2017

Doesn't https://jsfiddle.net/ymr6aeck/3/ solve your issue?

@artur-code
Copy link
Author

@n1k0 Thank you. This solves my problem partially. I need to render the scheme with many levels of nesting. This is my scheme - https://jsfiddle.net/3gyh1u4w/. I want to make a render my custom components at all levels of nesting. Is it possible to render with 3-10 levels of nesting custom components ?

@n1k0
Copy link
Collaborator

n1k0 commented Feb 27, 2017

I can't see why it wouldn't work. Did you try?

@artur-code
Copy link
Author

@n1k0 This is code with 3 levels of nested components - https://jsfiddle.net/21964wcm/1/ and this is work. But I need the implementation in which the components do not know anything about ui:scheme. On the backend generated different schemes. The cliend side shall be automatically generated forms with different custom components. Component which one scheme - Parent to another scheme may be Child. If you have any ideas how this can be implemented using react-jsonschema-form I'll be happy. Thanks in advance for your time.

@glasserc
Copy link
Contributor

glasserc commented Sep 6, 2017

If I understood your question correctly, you want the backend to generate different schemas, but the backend is ignorant of uiSchema. Can you write JavaScript to automatically generate a uiSchema from the JSON schema?

@glasserc
Copy link
Contributor

glasserc commented Sep 6, 2017

This might also be related to #477.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants