Skip to content
This repository has been archived by the owner on Jan 15, 2022. It is now read-only.

Nested data #83

Closed
joneshf opened this issue Nov 7, 2014 · 2 comments
Closed

Nested data #83

joneshf opened this issue Nov 7, 2014 · 2 comments

Comments

@joneshf
Copy link
Contributor

joneshf commented Nov 7, 2014

I have some objects that I want to display. It happens that sometimes the objects contains objects themselves. Currently, reactable just stringifies it, so you end up with "[object Object]" or some such. How do you want to handle nested data like this?

@glittershark
Copy link
Owner

Just thinking about the API requirements for supporting colspan and rowspan makes my head hurt. It's something we should totally do (flexibility!) but I don't think it's a reasonabe goal for 1.0.

As far as JSON.stringifying cell data goes, you should just be able to:

var source_data = [{ column1: 'regular value', column2: { an_object: 'with keys' } }];

<Reactable.Table data={source_data.map(function(row) {
    var newRow = {};
    for (var k in row) {
        var val = row[k];
        if (typeof(val) === 'string') {
            newRow[k] = val;
        } else {
            newRow[k] = JSON.stringify(val);
        }
    }
    return newRow;
})} />

Since it's pretty rare that end-users are going to be happy seeing JSON in their table cells anyway, I don't see much of a case for adding this to Reactable itself.

@glittershark
Copy link
Owner

#84 is the issue for supporting colspan and rowspan if you want to throw in your two cents there.

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

No branches or pull requests

2 participants