DataTables Base Fiddle
by EE_RainerJ
HTML
<link rel="stylesheet" href="//cdn.datatables.net/1.10.6/css/jquery.dataTables.css">
<script src="//cdn.datatables.net/1.10.6/js/jquery.dataTables.min.js"></script>
<table id="example" class="display" cellspacing="0">
<thead>
<tr>
<th>Id</th>
<th>Name</th>
<th>Country</th>
<th>Solutions</th>
</tr>
</thead>
</table>
JavaScript
$(document).ready(function() {
var results = [];
var url = "https://spreadsheets.google.com/feeds/list/1WMbRG1H3MP79IVCgUSR6asrmca59KiwGykGGOVgjLfA/od6/public/values?alt=json";
var jqxhr = $.getJSON(url, function() {
console.log( "success" );
})
.done(function(data) {
console.log( "second success" );
var entry = data.feed.entry;
$(entry).each(function(){
// Column names are name, age, etc.
//results.push({"Id" : this.gsx$id.$t , "Name" : this.gsx$name.$t, "Country" : this.gsx$country.$t, "Solutions" : this.gsx$solutions.$t});
results.push([this.gsx$id.$t , this.gsx$name.$t, this.gsx$country.$t, this.gsx$solutions.$t]);
});
var table = $('#example').DataTable( {
data: results,
columns: [
{ title: "Id" },
{ title: "Name" },
{ title: "Country" },
{ title: "Solutions" }
]
});
})
.fail(function() {
console.log( "error" );
})
.always(function() {
console.log( "complete" );
});
});