https://github.com/martinberlin/datatables-dynamic-columns
A solution to add dynamic headers to Allan's great jQuery plugin
https://github.com/martinberlin/datatables-dynamic-columns
javascript
Last synced: over 1 year ago
JSON representation
A solution to add dynamic headers to Allan's great jQuery plugin
- Host: GitHub
- URL: https://github.com/martinberlin/datatables-dynamic-columns
- Owner: martinberlin
- License: gpl-3.0
- Created: 2016-05-26T09:46:24.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2020-11-12T14:59:26.000Z (over 5 years ago)
- Last Synced: 2025-02-28T19:53:25.651Z (over 1 year ago)
- Topics: javascript
- Language: HTML
- Homepage: http://fasani.de
- Size: 124 KB
- Stars: 38
- Watchers: 5
- Forks: 14
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# Datatables with dynamic columns
A solution to add dynamic headers to datatables jQuery plugin.
This public repository will help to post solutions and code-snippets we find useful, please feel free to fork and add your own commentaries and examples.
Resume:
- dynamic-headers.html loads json from data/data.json
The idea is that in the JSON we define the columns, adding a **name** additional attribute that defines the Title of the table header
Any other render or transformation applied to the column should be defined in the Javascript code (see example)
## Test notes:
datatables js and css is included for demo purposes. Please download latest version of datatables here:
[https://datatables.net/download](https://datatables.net/download)
## Exceptions
Using this dynamic generation of Columns won't play well with:
"serverSide": true
Since we are “fabricating” the table ourselves. Other than that so far everything else works just as a normal dataTable.
### Thanks to
Allan from Datatables for creating such an awesome data visualization plugin. Using if for more than 3 years and counting!
Diego for his help on building a simple, yet effective logic.
[SkyGate GmbH](https://www.skygate.de) for giving me the time and support to do this and share it in an open repository
### Sponsoring
If you like this solution please consider becoming a sponsor where you can donate as little as 2 u$ per month. Just click on:
**❤ Sponsor** on the top right
♢ For cryptocurrency users is also possible to help this project transferring Ethereum:
0x68cEAB84F33776a7Fac977B2Bdc0D50933344086
We are thankful for the support and contributions so far!