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

Customizing individual columns that are not in additional rows #102

Closed
appsciences opened this issue Jan 19, 2015 · 2 comments
Closed

Customizing individual columns that are not in additional rows #102

appsciences opened this issue Jan 19, 2015 · 2 comments

Comments

@appsciences
Copy link

It's quite common IMO to have selection or edit/delete controls as first column in a table. While there's a great way to customize columns in "additional" rows using Tr->Td..., I haven't found a way to insert controls into columns that would trigger React events.

@glittershark
Copy link
Owner

Something like:

var data = [{a: 1, b: 2}, {a: 3, b: 4}];

React.renderComponent(
    <Table>
        {data.map(function(row) {
            return (
                <Tr>
                    <Td column="a">{row.a}</Td>
                    <Td column="b">{row.b}</Td>
                    <Td column="delete">
                        <a onClick={function(ev) {
                            alert('do some XHR or something here');
                        }}>Delete</a>
                    </Td>
                </Tr>
            )
        })}
    </Table>,
    document.getElementById('my-table')
);

should work. Remember that this is all still React, and anything you can do with React you can do with Reactable

Feel free to reopen the issue if you run into any other problems 😄

@nlaffey
Copy link

nlaffey commented Sep 22, 2016

@glittershark Do you still feel this is a valid solution? It seems like your response is trying to do what this pull request is trying to enable: #196

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

3 participants