Im trying dynatable and Im running into an issue. I not sure how to update records from different json files.
My html body:
<input type="button" value="items a" id="setToItemsA"><br>
<input type="button" value="items b" id="setToItemsB"><br>
<br><br>
<table id="my-final-table">
<thead>
<th>Band</th>
<th>Song</th>
</thead>
<tbody>
</tbody>
</table>
my script
$(document).ready(function() {
var json1 = [
{
"band": "Weezer",
"song": "El Scorcho"
},
{
"band": "Chevelle",
"song": "Family System"
}
];
var json2 = [
{
"band": "Band1",
"song": "Song1"
},
{
"band": "Band2",
"song": "Song2"
}
];
$('#my-final-table').dynatable({
dataset: {
records: json1
}
});
$('#setToItemsA').click(
function() {
setToItems(json1);
});
$('#setToItemsB').click(
function() {
setToItems(json2);
});
function setToItems (argument) {
console.log(argument);
$('#my-final-table').dynatable({
dataset: {
records: argument
}
});
}
});
I tried to unbind the table and redo it with the new dataset but did not work. I honestly dont know. Thanks for your help!