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

Add docs for sortable Table and sorted TableCell #1195

Closed
1 of 2 tasks
levithomason opened this issue Jan 20, 2017 · 7 comments
Closed
1 of 2 tasks

Add docs for sortable Table and sorted TableCell #1195

levithomason opened this issue Jan 20, 2017 · 7 comments

Comments

@levithomason
Copy link
Member

levithomason commented Jan 20, 2017

See #1109 which was merged without:

  • docs
  • typings
@levithomason
Copy link
Member Author

/cc @ben174

@layershifter layershifter changed the title Add typings and docs for sortable Table and sorted TableCell Add docs for sortable Table and sorted TableCell Jan 24, 2017
@layershifter layershifter removed their assignment Jan 24, 2017
@layershifter
Copy link
Member

PR for typings was merged, we need docs 😄

@levithomason
Copy link
Member Author

Updated the description with a task list, thanks!

@ben174
Copy link
Contributor

ben174 commented Jan 30, 2017

Trying to wrap my head around how this sorting functionality is expected to be implemented. Shouldn't there be a onColumnSorted property for the table? I don't see it in the PR.

@levithomason
Copy link
Member Author

It is a style only prop, it does not affect your data. Use a click handler to handle sorting and updating the sort direction.

@hopewise
Copy link

hopewise commented Apr 28, 2020

It seems that its not working?

I have tried as:

<Table celled className="sortable">
            <Table.Header>
                <Table.Row>
                    <Table.HeaderCell >First Name</Table.HeaderCell>
                    <Table.HeaderCell sorted='descending'>Last Name</Table.HeaderCell>
                    <Table.HeaderCell>Circuit title</Table.HeaderCell>
                    <Table.HeaderCell>Created at</Table.HeaderCell>
                    <Table.HeaderCell>Updated at</Table.HeaderCell>
                    <Table.HeaderCell></Table.HeaderCell>
                </Table.Row>
            </Table.Header>

for the sorted cell above, I tried both enums for sorted property, but the table list users the same order

is there some consideration when building the table rows?
I do build it like this:

<Table.Body>
                {this.state.experiments.map(experiment=>(
                    <Table.Row key={experiment.id}>
                        <Table.Cell collapsing>
                            <a href={experiment.user_url} target="_blank">
                                {experiment.creator.firstname}
                            </a>                             
                        </Table.Cell>
                        <Table.Cell collapsing>
                            <a href={experiment.user_url} target="_blank">
                                {experiment.creator.lastname}
                            </a>                             
                        </Table.Cell>

also, clicking on arrow of table header cell will not do anything, I have:

"semantic-ui-react": "^0.86.0"

@levithomason
Copy link
Member Author

The prop just adds the styling to appear sortable. See the logic here:

https://react.semantic-ui.com/collections/table/#variations-sortable

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

No branches or pull requests

4 participants