Skip to content

Get value from key first; if not existing, try recursive get #1383

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

Merged
merged 1 commit into from
May 31, 2020

Conversation

CYBAI
Copy link
Contributor

@CYBAI CYBAI commented May 23, 2020

Due to splitting object field by dot (.), when an user provides a data
which key has a dot, it will cause an issue for an undefined data
which looks like not rendered.

So, to solve this, we should try to get the object value from the key
first. If it's not defined or null, then we will try to do the original
recursive way to get value.

Fix #1381

Due to splitting object field by dot (.), when an user provides a data
which key has a dot, it will cause an issue for an `undefined` data
which looks like not rendered.

So, to solve this, we should try to get the object value from the key
first. If it's not defined or null, then we will try to do the original
recursive way to get value.
@avindra
Copy link

avindra commented May 27, 2020

Thanks for looking into this. It seems like the "Nested field" feature was added by @AllenFang here in response to a popular RBT 1 issue. I think Allen had the right idea to reject this nested field feature initially, as it adds more complications to this library.

The users on the original issue thread came up with a number of ways of handling this outside the table library (i.e., massage your own data), and there are certainly more ways than _.get from lodash.

But of course this feature already went out so it would be weird to remove it now. Handling this in the getter util seems like a good fix.

@CYBAI
Copy link
Contributor Author

CYBAI commented May 27, 2020

I think Allen had the right idea to reject this nested field feature initially, as it adds more complications to this library.

Indeed; it's possible that adding this would make it much more difficult to debug in the future.

The users on the original issue thread came up with a number of ways of handling this outside the table library

If users find their own way to handle the data, it sounds great 👀

Handling this in the getter util seems like a good fix.

It's indeed an easy fix but I think it's fine for me to close it if @AllenFang will worry about adding more complexity to this library.

Feel free to close it if there's any concern!

@AllenFang
Copy link
Member

thanks @CYBAI 🇹🇼 I will release it later

@AllenFang AllenFang changed the base branch from master to develop May 31, 2020 06:16
@AllenFang AllenFang changed the base branch from develop to master May 31, 2020 06:16
@AllenFang AllenFang merged commit b2695fd into react-bootstrap-table:master May 31, 2020
@CYBAI CYBAI deleted the fix-1381 branch May 31, 2020 10:09
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

Successfully merging this pull request may close these issues.

Table fails to render data containing dots in key names
3 participants