I am trying to create a table using Dynatable to show data which is provided on a remote URL
I am testing out a class management solution called Jackrabbit, which provides an endpoint (here - which has my sample data) containing class lists in JSON.
I've looked at dynatable not creating table from remote JSON & Load remote JSON from Dynatable but I haven't been able to figure out a solution.
I've been working in this JS Fiddle
$(document).ready(function(){$.getJSON("https://app.jackrabbitclass.com/jr3.0/Openings/OpeningsJSON?orgID=537284", function(data) {
$("#classes").dynatable({
dataset: {
records: data
}
});
});})
The external JSON file contains many different fields, but I am only using some of them for the table. Is anyone able to point me in the right direction?
Your script's dataset records data are not pass properly table structural way. Just replace your script with follows and don't forget to fill blank data array value with from data_value ( I added only name and instructions, please set others data ) -
$(document).ready(function(){$.getJSON("https://app.jackrabbitclass.com/jr3.0/Openings/OpeningsJSON?orgID=537284", function(data) {
var data_arr = [];
$.each(data.rows, function(key, data_value){
data_arr.push({
'name' : data_value.name,
'instructors' : data_value.instructors[0],
'meeting_days' : '',
'min_age' : '',
'openings' : '',
'start_time' : '',
'tuition' : '',
});
});
$("#classes").dynatable({
dataset: {
records: data_arr
}
});});});