Getting data into dataTables?
Getting data into dataTables?
Hi,
I really like the DataTables plugin but I am having an issue with importing data into it. I am trying to load a csv file into it, the closest I've got puts the data below the table. I am looking for help. Below you will find a snippet of my code.
$(function() {
/* grab data and place it into an array */
$.get("csv/flood_reports.csv", function(data) {
arrayContainer = $.csv()(data);
$.each(arrayContainer, function() {
var row = String(this).split(",");
if (row[0] != "") {
$('#flood_reports_content')
.append("" +
"" + row[0] + "" +
"" + row[1] + "" +
"" + row[2] + "" +
"" + row[3] + "" +
"" + row[4] + "" +
""
);
}
});
});
});
/* flood reports content table */
$(function() {
$('#flood_reports_content').dataTable({
"sPaginationType": "full_numbers"
});
});
I really like the DataTables plugin but I am having an issue with importing data into it. I am trying to load a csv file into it, the closest I've got puts the data below the table. I am looking for help. Below you will find a snippet of my code.
$(function() {
/* grab data and place it into an array */
$.get("csv/flood_reports.csv", function(data) {
arrayContainer = $.csv()(data);
$.each(arrayContainer, function() {
var row = String(this).split(",");
if (row[0] != "") {
$('#flood_reports_content')
.append("" +
"" + row[0] + "" +
"" + row[1] + "" +
"" + row[2] + "" +
"" + row[3] + "" +
"" + row[4] + "" +
""
);
}
});
});
});
/* flood reports content table */
$(function() {
$('#flood_reports_content').dataTable({
"sPaginationType": "full_numbers"
});
});
This discussion has been closed.