coston / react-super-responsive-table Goto Github PK
View Code? Open in Web Editor NEWTurn the tables on unresponsive data!
Home Page: https://react-super-responsive-table.vercel.app
License: MIT License
Turn the tables on unresponsive data!
Home Page: https://react-super-responsive-table.vercel.app
License: MIT License
It would be great to add eg is-mobile
class when table is in mobile view, it would help to style table for each responsive modes
I couldn't able to add two tables using this package in my class. Why does it happens? Or any way to use two tables on same class?
Is this an issue or I don't know to use it?
It will be great if you provide paging, filtering, sorting support for this awesome table? Any possibility of implementing?
Currently getting the following error output when using your library with React v16.2.0
It appears in your code as columnKey
but should be spelt all lowercase to avoid the error. Has anyone else come across this?
Warning: React does not recognize the `columnKey` prop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercase `columnkey` instead. If you accidentally passed it from a parent component, remove it from the DOM element.
in th (at health-service-results.jsx:18)
in tr (created by TrInner)
in TrInner (created by WithContext(TrInner))
in WithContext(TrInner) (at health-service-results.jsx:17)
in thead (created by Thead)
in Thead (at health-service-results.jsx:16)
in table (created by Table)
in ProvideContext (created by Table)
in Table (at health-service-results.jsx:15)
in div (at health-service-results.jsx:8)
in div (at health-service-results.jsx:7)
in HealthServiceResults (at health-checks.jsx:125)
in div (at health-checks.jsx:163)
in HealthChecks (created by Route)
in Route (created by withRouter(HealthChecks))
in withRouter(HealthChecks) (at App.jsx:103)
in Route (at App.jsx:103)
in Switch (at App.jsx:96)
in ScrollToTop (created by Route)
in Route (created by withRouter(ScrollToTop))
in withRouter(ScrollToTop) (at App.jsx:95)
in div (at App.jsx:91)
in div (at App.jsx:80)
in Router (created by BrowserRouter)
in BrowserRouter (at App.jsx:79)
in App (at index.js:12)
Thead Showing Error
I am trying to integrate react-super-responsive-table with the help of react-table hook,
It is showing error :
Uncaught Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.
at createFiberFromTypeAndProp
When I use htlm thead tag it works fine.
To Reproduce
Steps to reproduce the behavior:
<Table>
<Thead>
<Tr>
<Th>we</Th>
</Tr>
</Thead>
</Table>
Custom breaking points to define where should become display block along with .
For eg: If someone want to transition from Table view to card view when screen size is < 700px .
Currently it set to 40em @media screen and (max-width: 40em)
, even after changing it item remains hidden.
Hey there! Great component. Am really hoping I could get some help fixing this issue as it seems to be throwing an error.
Warning: Unknown prop
columnKey on <td> tag. Remove this prop from the element. For details, see https://fb.me/react-unknown-prop
in td (created by Unknown) in tr (created by TrInner) in TrInner (created by Unknown) in Unknown (created by Unknown) in tbody (created by Tbody) in Tbody (created by Unknown) in Unknown (created by ConnectedFieldArray) in ConnectedFieldArray (created by Connect(ConnectedFieldArray)) in Connect(ConnectedFieldArray) (created by FieldArray) in FieldArray (created by Form) in table (created by Table) in Unknown (created by Table) in Table (created by Form) in div (created by FieldWrapper) in FieldWrapper (created by Form) in div (created by Form) in div (created by Wrapper) in Wrapper (created by Form) in form (created by Form) in Form (created by Form(Form)) in Form(Form) (created by Connect(Form(Form))) in Connect(Form(Form)) (created by ReduxForm)
I took a look through the code and saw your handy pick
method that picks out safe props for elements (sneaky!). Some how I think ReduxForm is adding columnKey in.
this is really nice and seems the best one out there.. but need basic styling like stripping and table lines.. is there a way to set those?
Is your feature request related to a problem? Please describe.
A table is a an alternative to the html version <table>
.
Sadly, react-super-responsive-table has functions as well. Most people use a popular library called 'react-table' to setup filter, sorting, rendering of cell data. The beauty of React-table is it doesn't do anything with the actual "rendering" of a table. So I can use Semantic Ui React table without any fuzz. Sadly I couldn't use your library that easy. Could you make an alternative where you don't have to set states or variations ?
Describe the solution you'd like
Use react-super-responsive-table to render a responsive table inside react-table.
Describe alternatives you've considered
Could you consider making it work with react-table. I think it will increase this libraries popularity
Additional context
Code this isn't working
import { Table, Thead, Tbody, Tr, Th, Td } from 'react-super-responsive-table';
import 'react-super-responsive-table/dist/SuperResponsiveTableStyle.css';
...
<Table {...getTableProps()}>
<Thead>
{headerGroups.map((headerGroup) => (
<Tr {...headerGroup.getHeaderGroupProps()}>
{headerGroup.headers.map((column) => (
<Th {...column.getHeaderProps()}>
<div>
<span {...column.getSortByToggleProps()}>
{column.render("Header")}
{/* Add a sort direction indicator */}
{column.isSorted
? column.isSortedDesc
? " 🔽"
: " 🔼"
: ""}
</span>
</div>
</Th>
))}
</Tr>
))}
</Thead>
<Tbody {...getTableBodyProps()}>
{page.map((row) => {
prepareRow(row);
return (
<Tr {...row.getRowProps()}>
{row.cells.map((cell) => (
<Td {...cell.getCellProps()}>
{cell.render("Cell")}
</Td>
))}
</Tr>
);
})}
</Tbody>
Code that is working fine```
import { Pagination, Table } from "semantic-ui-react";
...
<Table {...getTableProps()}>
<Table.Header>
{headerGroups.map((headerGroup) => (
<Table.Row {...headerGroup.getHeaderGroupProps()}>
{headerGroup.headers.map((column) => (
<Table.HeaderCell {...column.getHeaderProps()}>
<div>
<span {...column.getSortByToggleProps()}>
{column.render("Header")}
{/* Add a sort direction indicator */}
{column.isSorted
? column.isSortedDesc
? " 🔽"
: " 🔼"
: ""}
</span>
</div>
</Table.HeaderCell>
))}
</Table.Row>
))}
</Table.Header>
<Table.Body {...getTableBodyProps()}>
{page.map((row) => {
prepareRow(row);
return (
<Table.Row {...row.getRowProps()}>
{row.cells.map((cell) => (
<Table.Cell {...cell.getCellProps()}>{cell.render("Cell")}</Table.Cell>
))}
</Table.Row>
);
})}
</Table.Body>
{/** Shows NoResult component if data is missing. */}
{page.length === 0 && <SearchNoResult type="table" />}
</Table>
Hi,
I have a table where I don't know how many columns there will be until the table is rendered. I receive the following error:
Uncaught Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.
at invariant (http://localhost/static/js/1.chunk.js:45401:19)
at createFiberFromTypeAndProps (http://localhost/static/js/1.chunk.js:55995:15)
at createFiberFromElement (http://localhost/static/js/1.chunk.js:56015:19)
at reconcileSingleElement (http://localhost/static/js/1.chunk.js:58382:27)
at reconcileChildFibers (http://localhost/static/js/1.chunk.js:58442:39)
at reconcileChildren (http://localhost/static/js/1.chunk.js:60306:32)
at updateHostComponent (http://localhost/static/js/1.chunk.js:60790:7)
The above error occurred in the <thead> component:
in thead (created by Thead)
in Thead (at Table.js:139)
My code is:
<Table {...getTableProps()} className='table table-striped table-hover'>
<Thead>{headerGroups.map((h, i) => {
<Tr>
<Th>{i}</Th>
</Tr>
})
}
</Thead>
<Tbody>
{page.map(
(row, i) => {
console.log(row)
return prepareRow(row) || (
<Tr {...row.getRowProps()} className={!row.original.isViewed ? 'unviewed' : ''}>
{row.cells.map(cell => {
return (
<Td {...cell.getCellProps()}>{cell.render('Cell')}</Td>
)
})}
</Tr>
)}
)}
</Tbody>
</Table>
I am using this along with react-table. The suggestions on the ReadMe for dynamic header titles seems related to my issue, but it hasn't provided me with any clues.
Warning: Unknown props `inHeader`, `responsiveTable` on <tr> tag. Remove these props from the element. For details, see https://fb.me/react-unknown-prop
in tr (created by TrInner)
in TrInner (created by Unknown)
in Unknown (created by ...)
in thead (created by Thead)
in Thead (created by ...)
in table (created by Table)
in Unknown (created by Table)
in Table (created by ...)
...
code:
<Table>
<Thead>
<Tr>
<Th>some text</Th>
<Th>test</Th>
</Tr>
</Thead>
</Table>
Is your feature request related to a problem? Please describe.
I have tables with many columns and I'd like to be able to pass in a breakpoint so that the table will respond to larger sized view ports. So for tablet I would still like to show the responsive table.
Describe the solution you'd like
Ability to pass a prop into the Table component with the breakpoint size.
Describe alternatives you've considered
I tried overriding the CSS but the headers were not working. I am assuming there is code that updates the elements based on viewport size
Additional context
Having to add a dynamic header key to the Table could be engineered out. Do it in a lightweight way, ideally with no breaking changes.
Hi here i want to fix the column headers and fixed columns in the table
Warning: Unknown prop `columnKey` on <th> tag. Remove this prop from the element. For details, see https://fb.me/react-unknown-prop
in th (created by Th)
in Th (created by ...)
in tr (created by TrInner)
in TrInner (created by Unknown)
in Unknown (created by ...)
in thead (created by Thead)
in Thead (created by ...)
in table (created by Table)
in Unknown (created by Table)
in Table (created by ...)
<Table>
<Thead>
<Tr>
<Th>we</Th>
<Th>ss</Th>
</Tr>
</Thead>
</Table>
I needed to add "rowSpan" to my <Td>
component and it didn't work. Then I looked over the code and saw that the "colSpan" attribute is being considered and when this is sent to the component all the other props are also sent to the html <td>
component.
This means that if I use <Td rowSpan={2}>[...]</Td>
the "rowSpan" attribute will get ignored but if I use something like <Td colSpan={1} rowSpan={2}>[...]</Td>
my "rowSpan" attribute will be passed to the html <td>
component and I will get my desired functionality.
Can you please pass the props to the html <td>
component when there is no "colSpan" involved?
class TdInner extends React.Component {
render() {
if (this.props.colSpan) {
return <td {...allowed(this.props)} />
}
const { headers, children, columnKey } = this.props
const classes = (this.props.className || '') + ' pivoted'
return (
<td className={classes} {...allowed(this.props)}> {/*<<=== Here I added the props */}
<div className="tdBefore">{headers[columnKey]}</div>
{children || <div> </div>}
</td>
)
}
}
Hello,
I don't really understand how to use dynamic headers. I am trying to integrate my headers for the table like this:
<Thead>
<Tr>
<Th></Th>
{headers.map((header, i) => (
<Th key={i} className={classes.headCell}>
{header}
</Th>
))}
</Tr>
</Thead>
However, when I check the headers for small devices, the first 2 headers are the only ones shown.
Thanks for your attention, I really like this project.
Describe the bug
Using variable with falsy value equal to zero renders   instead of zero.
To Reproduce
Code:
const stats = 0;
<Td>{stats}</Td>
Results:
<td><div class="tdBefore">Stats</div><div> </div></td>
Expected behavior
<td><div class="tdBefore">Stats</div>0</td>
react-component-gulp-tasks
seems unmaintained and doesn't work with Node 8. Maybe use a different boilerplate module for compability with new Node versions and Javascript syntax?
Issue:
It is not possible to use conditional columns:
{false && <Td>Column</td>}
Error:
Uncaught Error: React.cloneElement(...): The argument must be a React element, but you passed null.
at invariant (:3000/static/js/vendors.chunk.js:50842)
at Object.cloneElement (:3000/static/js/vendors.chunk.js:158017)
at Object.cloneElementWithValidation [as cloneElement] (:3000/static/js/vendors.chunk.js:158886)
at :3000/static/js/vendors.chunk.js:142170
at mapSingleChildIntoContext (:3000/static/js/vendors.chunk.js:158347)
Fix:
#62
When there is only one column in Tr
it will throw the following exception.
props.children
is not array
in this case.
new TrInner
node_modules/react-super-responsive-table/dist/SuperResponsiveTable.js:103
100 | var headers = props.responsiveTable.headers;
101 |
102 | if (headers && props.inHeader) {
> 103 | props.children.map(function (child, i) {
| ^ 104 | headers[i] = child.props.children;
105 | });
106 | }
Fix:
#60
Describe the bug
Whenever the screen goes under 700px the table disappears but when it reaches 639px the table is shown again in its mobile format.
Is your feature request related to a problem? Please describe.
Yes, Having to use the inbuilt components, there used to be a JQuery Lib (Stacktable) where you used to just give it the table element and it would work out the rest from there.
Describe the solution you'd like
With using React I think we could do similar to that where we can build a wrapper component something like <AutoTableWrapper>...</AutoTableWrapper>
and that would search the children for a table element.
Additional context
The reason i need a solution like this is we have an admin system that allows people to add tables inside a WYSIWYG editor and we want to be able to stack them for mobile users.
Is your feature request related to a problem? Please describe.
The component does not seem to work with dynamic creation of tables. I tried on a static table with no issues.
Describe the solution you'd like
Ability to use dynamic data tables
Describe alternatives you've considered
Additional context
Describe the bug
I have a table with five columns; displays just fine when the display is wide. When the display "flips", the column values are properly displayed but where the column headers should be, there is empty space.
To Reproduce
Trying to set up a codeSandbox to show the behavior...
Steps to reproduce the behavior:
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
If applicable, add screenshots to help explain your problem.
Wide display:
Narrow Display:
Desktop (please complete the following information):
Smartphone (please complete the following information):
N/A
Additional context
Add any other context about the problem here.
This version is covered by your current version range and after updating it in your project the build failed.
This monorepo update includes releases of one or more dependencies which all belong to the react group definition.
react is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
<iframe>
regression (@JSteunou in #13650)updateWrapper
so that <textarea>
s no longer re-render when data is unchanged (@joelbarbosa in #13643There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot 🌴
This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.
These updates are awaiting their schedule. Click on a checkbox to get an update now.
These updates await pending status checks. To force their creation now, click the checkbox below.
These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.
.github/workflows/nodejs-ci.yml
actions/checkout v3
actions/setup-node v3
.github/workflows/release.yml
actions/checkout v3
actions/setup-node v3
package.json
@babel/cli 7.24.5
@babel/core 7.24.5
@babel/plugin-transform-runtime 7.24.3
@babel/plugin-transform-spread 7.24.1
@babel/preset-env 7.24.5
@babel/preset-react 7.24.1
@commitlint/cli 19.3.0
@commitlint/config-conventional 19.2.2
@next/eslint-plugin-next ^14.0.0
@testing-library/jest-dom 6.4.5
@testing-library/react 15.0.7
@babel/eslint-parser 7.24.5
babel-jest 29.7.0
coveralls 3.1.1
eslint 8.57.0
eslint-config-airbnb 19.0.4
eslint-config-prettier 9.1.0
eslint-plugin-import 2.29.1
eslint-plugin-jsx-a11y 6.8.0
eslint-plugin-prettier 5.1.3
eslint-plugin-react 7.34.1
eslint-plugin-react-hooks 4.6.2
husky 9.0.11
identity-obj-proxy 3.0.0
jest 29.7.0
jest-environment-jsdom 29.7.0
lint-staged 15.2.2
next 14.2.3
prettier 3.2.5
prop-types 15.8.1
react 18.3.1
react-dom 18.3.1
react-pkg-demo ^0.1.8
react-test-renderer 18.3.1
react-window-ui 2.2.0
rimraf 5.0.6
styled-components 6.1.11
prop-types >= 15
react >=16.9.0
react-dom >=16.9.0
node >=12
.travis.yml
There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.
Error type: undefined. Note: this is a nested preset so please contact the preset author if you are unable to fix it yourself.
Describe the bug
Half of the rows are not visible. happening with every alternate row.
Only happening on ios devices.
Works fine with every other device.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
All rows should be visible.
Screenshots
Smartphone (please complete the following information):
Not able to make header in fixed position for long lit of data. Could you please suggest ?
Describe the bug
Table looks broken when you have long labels in table header.
To Reproduce
Try to render following table:
<Table>
<Thead>
<Tr>
<Th>Very loooooooooooooooooooooooooooooong label</Th>
<Th>Very loooooooooooooooooooooooooooooong label</Th>
</Tr>
</Thead>
<Tbody>
{
[0,1,2,3,4].map(() => {
return(
<Tr>
<Td>testing values testing values testing values testing values </Td>
<Td>testing values testing values testing values testing values </Td>
</Tr>
)
})
}
</Tbody>
</Table>
Expected behavior
I am expecting to get the same behaviour as <td>
tag for <th>
, so when there is no enough space, the line should break into multiple lines.
Desktop (please complete the following information):
It could be really useful to have a prop to set a different column name for a single row.
Let's take as example this table:
Product | Quantity | Price |
---|---|---|
Item 1 | 1 | 5 $ |
Item 2 | 3 | 7 $ |
Item 3 | 2 | 3 $ |
Total | 6 | 15 $ |
When pivoting it, I get the Total row mixed up, like:
I'd love to have the ability to:
Product
one)Total items
and Total price
)Idally this would become, just for the pivoted view:
It would be nice to support the tag for tables with summarizing rows. Any plans for that?
Is your feature request related to a problem? Please describe.
Hello ! I would like to make my table clickable, even for the duplicated <th>,
in responsive. Currently I can only make the <Td>
be Link, but not the <Th>
.
Describe the solution you'd like
It would be great if we could setup a parameter to make the hole line clickable in responsive, or even in desktop.
Describe alternatives you've considered
I did put <Link>
in all my <Td>
to not break CSS. It works in responsive but the left part of the table, with column title, is not clickable.
Additional context
Thank you for your work, it's great to use !
Edit : added tags
I'm trying to iterate through an array of items with <Tr>
but when I set a key
property on <Tr>
<div>
{
this.state.users.map((user,index)=>{
return <Tr key={index}> ... </Tr>;
})
}
</div>
I have following error:
Warning: Unknown props `inHeader`, `responsiveTable` on <tr> tag. Remove these props from the element
and
Warning: Unknown prop `columnKey` on <th> tag. Remove this prop from the element.
When there is no key
react will complain
Each child in an array or iterator should have a unique "key" prop.
I have a checkbox in table header to select all checkboxes in the rows. How can I prevent, that this checkbox will be also repeat on every row?
<th dontRepeat><Checkbox id={'check-all-tasks'} onClick={checkAll} color='primary'/></th>
I see that the overflow of content inside cells is not dealt with.
I propose a prop called "wordBreak" (BOOLEAN) to be introduced for the "Td" and "Th" components which would dynamically add style property: word-break:break-all;
To see what happens to your code in Node.js 10, Greenkeeper has created a branch with the following changes:
.travis.yml
package.json
files, so that was left aloneIf you’re interested in upgrading this repo to Node.js 10, you can open a PR with these changes. Please note that this issue is just intended as a friendly reminder and the PR as a possible starting point for getting your code running on Node.js 10.
Greenkeeper has checked the engines
key in any package.json
file, the .nvmrc
file, and the .travis.yml
file, if present.
engines
was only updated if it defined a single version, not a range..nvmrc
was updated to Node.js 10.travis.yml
was only changed if there was a root-level node_js
that didn’t already include Node.js 10, such as node
or lts/*
. In this case, the new version was appended to the list. We didn’t touch job or matrix configurations because these tend to be quite specific and complex, and it’s difficult to infer what the intentions were.For many simpler .travis.yml
configurations, this PR should suffice as-is, but depending on what you’re doing it may require additional work or may not be applicable at all. We’re also aware that you may have good reasons to not update to Node.js 10, which is why this was sent as an issue and not a pull request. Feel free to delete it without comment, I’m a humble robot and won’t feel rejected 🤖
There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot 🌴
onClick handlers do not fire ( nor the cursor transition) at 800 px or less.
I am only showing a portion of the code. Here you can see two onClick handlers. They function great above 800 px in desktop browsers chrome, edge etc., At 800 px and above I see Theads are on top (horizontal row). Below 800 px the Thead is vertical and goes as first column, that is when the onClicks do not function.
<Thead>
<Tr>
<Th>Image</Th>
<Th onClick={this.doSortByName} className="cur-pointer" scope="col">Name</Th>
<Th>Phone</Th>
<Th>Email</Th>
<Th onClick={this.doSortByDOB} className="cur-pointer" scope="col">DOB</Th>
</Tr>
</Thead>
It also does not work on mobile devices since the screen width is less than 800 px. I built my student app using react and used the react-super-responsive-table. Other than this issue, the table is pretty responsive.
Is your feature request related to a problem? Please describe.
My table's layout is breaking before the media query styles kick in and reflow the content.
Describe the solution you'd like
Given that all tables will vary in content, I think it would be useful to accept a prop to determine when to shift the layout of the table as opposed to setting a universal breakpoint for all.
Describe alternatives you've considered
I can override the styles or choose not import the stylesheet and create my own, but neither are very clean alternatives. Both options would require copying chunks of CSS from the stylesheet just to get started.
Additional context
This was already brought up in #122, but it was self-closed by the issue author, so I'm opening a new issue.
1.1.9
to 1.1.10
.This version is covered by your current version range and after updating it in your project the build failed.
mdx-go is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot 🌴
☝️ Important announcement: Greenkeeper will be saying goodbye 👋 and passing the torch to Snyk on June 3rd, 2020! Find out how to migrate to Snyk and more at greenkeeper.io
devDependency
@babel/cli was updated from 7.8.3
to 7.8.4
.devDependency
@babel/core was updated from 7.8.7
to 7.9.0
.devDependency
@babel/plugin-transform-spread was updated from 7.8.0
to 7.8.3
.devDependency
@babel/preset-env was updated from 7.8.7
to 7.9.0
.devDependency
@babel/preset-react was updated from 7.8.3
to 7.9.0
.This version is covered by your current version range and after updating it in your project the build failed.
This monorepo update includes releases of one or more dependencies which all belong to the babel7 group definition.
babel7 is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot 🌴
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.