JSON data source is good to display data which already is on your page. This is the most simple case of the configuration.
The component supports a certain format of JSON – array of objects, where each object is an unordered set of name/value pairs. For example:
var jsonData = [ { "Color" : "green", "Country" : "Canada", "State" : "Ontario", "City" : "Toronto", "Price" : 174, "Quantity" : 22 }, { "Color" : "red", "Country" : "USA", "State" : "California", "City" : "Los Angeles", "Price" : 166, "Quantity" : 19 } ];
You need to accomplish the following steps to use JSON data as a data source in pivot table embedded into your project.
Embedding Flexmonster Pivot is a simple copy-paste procedure that takes just minutes!
client/
folder into the web project root to your server.<div>
container for the component:
<div id="pivotContainer">The component will appear here</div>
flexmonster.js
into your HTML page. Please note, that your page should be in the same folder as flexmonster/
:
<div id="pivotContainer">The component will appear here</div> <script type="text/javascript" src="flexmonster/flexmonster.js"></script>
<div id="pivotContainer">The component will appear here</div> <script type="text/javascript" src="flexmonster/flexmonster.js"></script> <script> var pivot = new Flexmonster({ container: "pivotContainer", toolbar: true, licenseKey: "Z72R-XHF66S-1T5J3K-2D6X5A-2M216D-4V6969-241A6T-394Z4Z-14215Y-306T25" }); </script>
Run your web page and see the empty table. The next step is to see your own data on the grid.
Copy the following JSON and paste it into your HTML page:
<div id="pivotContainer">The component will appear here</div> <script type="text/javascript" src="flexmonster/flexmonster.js"></script> <script> var jsonData = [ { "Color" : "green", "Country" : "Canada", "State" : "Ontario", "City" : "Toronto", "Price" : 174, "Quantity" : 22 }, { "Color" : "red", "Country" : "USA", "State" : "California", "City" : "Los Angeles", "Price" : 166, "Quantity" : 19 } ]; var pivot = new Flexmonster({ container: "pivotContainer", toolbar: true, report: { dataSource: { data: jsonData } }, licenseKey: "Z72R-XHF66S-1T5J3K-2D6X5A-2M216D-4V6969-241A6T-394Z4Z-14215Y-306T25" }); </script>
Launch the web page from browser — here you go! A pivot table is embedded into your project.
See how JSON is used in client/index.html and connect to your own JSON.
Check pricing | Give a feedback | Documentation | Technical support |