Comments (4)
Of course! Sorry, I was using your example as the basis of my code, completely forgetting it was a JS object and needed the proper key values and not "columnKey" as in your example!!
Thank you so much!
from react-smart-data-table.
Hi @feudify ,
Can you please provide a sample of the data structure you are receiving from your http request? No need for values, just basic data = [{ key: { nestedKey: 'String' } }]
.
from react-smart-data-table.
Hi @joaocarmo ,
Thanks for the quick response.
Here you go:
[
{
"_id": "5d8118b18a9b5a76dc1a71ed",
"title": null,
"firstName": null,
"lastName": null,
"fullName": "sjcsd",
"postCode": "sdsdcsdc",
"email": null,
"uniqueReference": "scsdcd",
"placeholder": null
}
]
from react-smart-data-table.
So I took your code and modified in a way that it should work.
Notice that you were not providing the correct keys to the headers
object. You need to match the key in headers
with the key in the data. If the objected is nested, then use a string and dot notation like 'key.nestedKey'
. Also, boolean values need no arguments and can be passed down implicitly, e.g. withHeader
.
const headers = {
_id: {
text: 'Id',
invisible: true,
sortable: false,
filterable: false
},
title: {
text: 'Title',
invisible: false,
sortable: true,
filterable: true
},
firstName: {
text: 'First Name',
invisible: false,
sortable: true,
filterable: true
},
lastName: {
text: 'Last Name',
invisible: false,
sortable: true,
filterable: true
},
fullName: {
text: 'Full Name',
invisible: false,
sortable: true,
filterable: true
},
postCode: {
text: 'Post Code',
invisible: false,
sortable: true,
filterable: true
},
email: {
text: 'Email',
invisible: false,
sortable: true,
filterable: true
},
uniqueReference: {
text: 'Unique Reference',
invisible: false,
sortable: true,
filterable: true
},
placeholder: {
text: 'Placeholder',
invisible: false,
transform: () => {
return (
<button onClick={() => console.log("the button worked")}>
Show Details
</button>
)
}
}
}
<SmartDataTable
data={data}
headers={headers}
name='test-table'
filterValue={filterValue}
perPage={perPage}
sortable
withLinks
withHeader
loader={(
<div>Loading ...</div>
)}
/>
from react-smart-data-table.
Related Issues (20)
- Failed to compile HOT 6
- How to view 'No records available' as a row if data object is empty ? HOT 1
- Something went wrong ! SyntaxError: unterminated character class HOT 1
- Pagination customization/localization HOT 4
- Column ordering HOT 2
- Can't deploy to production with yarn build HOT 1
- Not fully compatible with Semantic UI's Pagination component HOT 2
- Header columns trimming Integers from names HOT 1
- Not displaying all the fields HOT 16
- Not paginating properly HOT 1
- Displaying duplicate columns when using 'header' props HOT 2
- Hide the paginator if the results per page were less than the perPage prop HOT 2
- Enhancement: Columns selector HOT 2
- "ReferenceError: self is not defined" when using blitz HOT 3
- Adding row double click HOT 1
- Pagination and activePage prop HOT 4
- Individual Column alignment HOT 3
- save the column width, sorts and filters HOT 1
- Give styles to specific row
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-smart-data-table.