jQuery JSON To Table Plugin - Download Convert JSON Data To Table - jQuery JSON To Table Plugin

Download Convert JSON Data To Table – jQuery JSON To Table Plugin

Posted on

This time I will share jQuery Plugin and tutorial about Convert JSON Data To Table – jQuery JSON To Table Plugin, hope it will help you in programming stack.

jQuery JSON To Table Plugin - Download Convert JSON Data To Table - jQuery JSON To Table Plugin

File Size: 8.92 KB
Views Total: 17648
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

A lightweight jQuery JSON to Table plugin which lets you generate a highly customizable html table from local JSON objects or external JSON data files.

How to use it:

1. Import the latest version of JQuery library and the jQuery JSON To Table plugin’s script into the document.

1 <script src="//code.jquery.com/jquery-3.2.1.min.js"></script>
2 <script src="JSON-to-Table.min.1.0.0.js"></script>

2. Create an empty container to place the generated html table.

1 <div id="table"></div>

3. The example JSON data.

01 var data = [{
02     "id": 1,
03     "first_name": "Alli",
04     "last_name": "Cassey",
05     "email": "acassey0@list-manage.com",
06     "gender": "Female",
07     "ip_address": "129.82.128.62"
08 }, {
09     "id": 2,
10     "first_name": "Clyde",
11     "last_name": "Bromage",
12     "email": "cbromage1@bbb.org",
13     "gender": "Male",
14     "ip_address": "232.45.125.179"
15 }, {
16     "id": 3,
17     "first_name": "Janeczka",
18     "last_name": "Trett",
19     "email": "jtrett2@vistaprint.com",
20     "gender": "Female",
21     "ip_address": "149.4.116.82"
22 }];

4. Convert the JSON data into an html table.

1 $('#demo').createTable(data);

5. Customize the styles of the html table in the JavaScript.

01 $('#demo').createTable(data,{
02   borderWidth: '1px',
03   borderStyle: 'solid',
04   borderColor: '#DDDDDD',
05   fontFamily: 'Verdana, Helvetica, Arial, FreeSans, sans-serif',
06  
07   thBg: '#F3F3F3',
08   thColor: '#0E0E0E',
09   thHeight: '30px',
10   thFontFamily: 'Verdana, Helvetica, Arial, FreeSans, sans-serif',
11   thFontSize: '14px',
12   thTextTransform: 'capitalize',
13  
14   trBg: '#FFFFFF',
15   trColor: '#0E0E0E',
16   trHeight: '25px',
17   trFontFamily: 'Verdana, Helvetica, Arial, FreeSans, sans-serif',
18   trFontSize: '13px',
19  
20   tdPaddingLeft: '10px',
21   tdPaddingRight: '10px'
22 });

This awesome jQuery plugin is developed by shahnewazshamim. For more Advanced Usages, please check the demo page or visit the official website.

source : jqueryscript.net