Security News
PyPI Now Supports iOS and Android Wheels for Mobile Python Development
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
react-js-table-with-csv-dl
Advanced tools
React JS tables and log viewer with stats if needed. Has the functionality to dowload table contents in CSV file with data stored in class prop.
React JS Table and log viewer with CSV download functionality accepts text, json and JSX for rendering.
React JS Table and log viewer with Search and CSV download functionality. You can display data table information passing JS objects and an array of data you want to show and download the full data into a csv file. You can pick what fields of the object you want to display and download the full objects. Also you can pass a String with a JSON and will be rendered.
How to thank me? Just click on ⭐️ button :)
Install it from npm and include it in your React build process (using Webpack, Browserify, etc).
npm i react-js-table-with-csv-dl
Import TableViewer
in your react component.
import TableViewer from 'react-js-table-with-csv-dl';
Props available:
content
- An array of objects. The key will be used for the table headers.let table = [
{number: 12, name: "Del Piero", position: "ST"},
{number: 21, name: "Pirlo", position: "MC"},
{number: 1, name: "Buffon", position: "GK"}
];
In the above example, will create a table with three columns: number, name, position
Optionally, you can add the key success
to the object. If value is true, the row will be displayed in green, if it is false will be displayed red.
let table = [
{number: 12, name: "Del Piero", position: "ST", success: true},
{number: 21, name: "Pirlo", position: "MC", success: false},
{number: 10, name: "Ruiz", position: "MDI"},
];
The above object will be displayed as follows:
headers
- An array of strings with the headers you want to display["number", "name"]
Use the same names as the object you are passing as prop.
In this case, the table will show only name
and number
. In case of downloading data, will download the full object including the position
. This gives you the ability of showing some fields and being able to download full data rows.
minHeight
, maxHeight
- Min and Max height dimensions for the table
activateDownloadButton
- (Boolean) if you want to have a download button
For example:
<TableViewer
title="Lineup"
content={this.state.table}
headers={this.state.headers}
minHeight={0}
maxHeight={400}
activateDownloadButton={this.state.activateDownloadButton}
/>
You can send a JSON String to a specific cell and will be rendered correctly with different color scheme as shows in the following image:
let json = {
"Key1": {"id":10,"values":"1-2"},
"Key2":{},
"Key3":"(Zone 1)",
"description":"","array":[100],
"array2":[],
"Object":[{"id":1000,"values":"K-1"}]
};
Note that you should convert JSON to a String using the function stringify(). Then, you'll have the result:
You can also customise the row's color (red, green or black) by sending the following row to the table with the key success
:
true -> green false -> red omit the key and the text will be black by default
{
number: 1,
name:() => <div><a href="#">Buffon</a></div>,
position: JSON.stringify(json),
success: true
}
If you have big tables, you can optionally add a pagination for the table using the prop pagination
.
You can also customize the style using the following props:
headerCss
=> style for headers e.g passing: {{color: "blue", backgroundColor:"#fff"}}
Changes the header background to white and the text to blue
bodyCss
=> style for each row e.g passing: {{color: "blue", backgroundColor:"#fff"}}
Changes the background to white and the text to blue
Name | Type | Mandatory | Description |
---|---|---|---|
activateDownloadButton | boolean | Y | Activates download button |
content | object | Y | Contents to display on tables |
headers | array (String) | Y | Array of strings, these will be used to choose what to show in the table |
maxHeight | integer | Y | Max table desired height |
minHeight | integer | Y | Min table desired height |
caseInsensitive | boolean | N | do searches without casing |
encoding | String | N | Data encoding for table and file, UTF-8 by default |
filename | String | N | Name of the downloaded filename (default is logResults.csv) |
maxPagesToDisplay | int | N | how many elements will the paginator have. Default 6 |
pagination | int | N | integer that will indicate the max page size for the table |
placeholderSearchText | string | N | Placeholder text to appear in Searchbox |
renderLineNumber | present | N | render row number at the left of the table |
reverseLineNumber | present | N | reverse line number to start from last (depends on reverseLineNumber) |
searchEnabled | presence (boolean) | N | Activate search feature |
sortColumn | string | N | Column that you want to sort Asc. (must be in headers prop) |
topPagination | boolean | N | show pagination at top of the table |
Name | Type | Mandatory | Description |
---|---|---|---|
activePageBoxStyle | object | N | customize style of active box |
bodyCss | object | N | Body customizations |
downloadButtonStyle | object | N | download button customizations |
headerCss | object | N | Headers customization |
pageBoxStyle | object | N | customize style of pagination box objects |
tableStyle | object | N | Overall table style/size |
titleStyle | object | N | Overall tile style/size |
errorColor | string | N | Hex value for text (default: #b30009) |
successColor | string | N | Hex value for text (default: #0b7012) |
warningColor | string | N | Hex value for text (default: #ba8722) |
v0.9.7
v0.9.6
v0.9.5
v0.9.4
v0.9.1
htmlTest = () => <div><a href="#">Yep</a></div>
v0.8.7
v0.8.6
v0.8.3
v0.7.10
v0.7.9
v0.7.8
v0.7.5
v0.7.3
v0.7.1
titleStyle
v0.7.0
tableStyle
for overall table stylingtableViewer
prefix, please change it to: tableWithCSV
Licensed under the MIT License © jciccio
FAQs
React JS tables and log viewer with stats if needed. Has the functionality to dowload table contents in CSV file with data stored in class prop.
The npm package react-js-table-with-csv-dl receives a total of 96 weekly downloads. As such, react-js-table-with-csv-dl popularity was classified as not popular.
We found that react-js-table-with-csv-dl demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.