Skip to content

Instantly share code, notes, and snippets.

@csessig86
Created March 11, 2013 23:40
Show Gist options
  • Save csessig86/5138959 to your computer and use it in GitHub Desktop.
Save csessig86/5138959 to your computer and use it in GitHub Desktop.
DataSet > DataTables part 4
// Load up the CSV using Miso.Dataset
$(document).ready( function() {
// Change URL to the right path for your CSV
var ds = new Miso.Dataset({
url : 'csvs/salary_book_clean.csv',
delimiter : ','
});
// Run this after we load our CSV
ds.fetch({ success : function() {
this.each(function(row, rowIndex) {
// Change these variables to match your column names
var employeeData = row.Employee;
var departmentData = row.Department;
var salaryData = row.TotalFY12Salary;
var genderData = row.Gender;
var countyData = row.County;
var positionData = row.Position;
// Put information in an array and push it to our table
// Change these variables to match variables above
var myArray = [employeeData, departmentData, salaryData, genderData, countyData, positionData];
newDataSet.push(myArray);
});
// Call DataTable function showInfo
showInfo();
}});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment