Skip to content
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

How to re-order anyOf items with ui-schema? #4298

Open
1 task done
perelin opened this issue Sep 12, 2024 · 3 comments
Open
1 task done

How to re-order anyOf items with ui-schema? #4298

perelin opened this issue Sep 12, 2024 · 3 comments
Labels
feature Is a feature request question

Comments

@perelin
Copy link

perelin commented Sep 12, 2024

Prerequisites

What theme are you using?

core

What is your question?

I have an anyOf array that is used to render a dropdown list. Now I want to change the order of the list elements with ui.schema (we cant change the actual json-schema files, they come from somewhere else). How can I do this?

Example:

{
  "anyOf": [
    {
      "const": "OPTION1",
      "title": "op1"
    },
    {
      "const": "OPTION2",
      "title": "op2"
    },
    {
      "const": "OPTION3",
      "title": "op3"
    }
  ],
  "type": "string"
}

How can I reorder them to eg [op3, op1, op2]?

Thanks!

@perelin perelin added needs triage Initial label given, to be assigned correct labels and assigned question labels Sep 12, 2024
@heath-freenome heath-freenome added feature Is a feature request and removed needs triage Initial label given, to be assigned correct labels and assigned labels Sep 13, 2024
@heath-freenome
Copy link
Member

heath-freenome commented Sep 16, 2024

@perelin There is currently no way to do it with uiSchema. You can, however, do it with either a custom widget or custom field, depending on how many fields you are dealing with.

@perelin
Copy link
Author

perelin commented Sep 17, 2024

Thanks for the reply @heath-freenome! We are using rjsf as it is provided by https://retool.com. Custom components would defeat the purpose of using a tool like retool. We might just do some processing on the schema file itself.

@heath-freenome
Copy link
Member

heath-freenome commented Sep 24, 2024

@perelin Ah I see. I've used retool in the past. So, yeah, it sounds like that is the best approach. Please close the issue if you feel like you have your answer

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

No branches or pull requests

2 participants