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

Properly hide rows when ui:widget is hidden (bootstrap-4) #2175

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const ObjectFieldTemplate = ({
)}
<Container fluid className="p-0">
{properties.map((element: any, index: number) => (
<Row key={index} style={{ marginBottom: "10px" }}>
<Row key={index} style={{ marginBottom: "10px" }} className={(element.content.props.uiSchema["ui:widget"] === "hidden")?"d-none":undefined} >
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, the analogous code in @rjsf/core just says:

{props.properties.map(prop => prop.content)}

When ui:widget is hidden, is element.content equal to null / undefined? I'm trying to see if we can achieve the same effect without having to explicitly check for ui:widget equal to hidden, such as something like the following:

{element.content && <Row>...</Row>}

Copy link
Author

@pjb7687 pjb7687 Dec 21, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi,

  1. element.content exists for the hidden fields.
  2. The row object contains the hidden input element, and removing the entire row means no hidden input element is included in the form.

<Col xs={12}> {element.content}</Col>
</Row>
))}
Expand Down