-
-
Notifications
You must be signed in to change notification settings - Fork 12
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
Add support for preview when collapsed #54
Comments
@igo It looks easy to implement. How about adding a <JsonView
+ collapsedPreviewLength={12}
/> |
To make this useful I need to select which fields to show. |
@igo Would it be acceptable if the API is designed like this? <JsonView
+ collapsedPreview={12}
/> <JsonView
+ collapsedPreview="some text"
/> <JsonView
+ collapsedPreview={(value, expandKey = '', level, keys = []) => {
+ return "some text"
+ }}
/> |
I do not fully understand your suggested API. I was thinking about something like this:
|
@igo I think callback functions would be more flexible. var object = {
"user": { "username": "tim" }
"address": [{"city": "NY"}]
}
<JsonView
value={object}
collapsedPreview={(value, expandKey = '', level, keys = []) => {
if (expandKey == "user") {
return value.username
}
if (expandKey == "city") {
return value
}
if (keys.join(".") == "user.address.0.city") {
return value
}
}}
/> |
Instead of showing three dots when collapsed
would be great to set which fields are important and try to show them in preview when collapsed:
The text was updated successfully, but these errors were encountered: