| runbunnyrun |
01-03-2013 07:46 PM |
misoproject datasets - how do i get data into a html table or list?
I am reposting this question because my previous post appears blank.
I am using http://misoproject.com/dataset/ javascript to import data from a google spreadsheet.
This data is called var = ds
I have then made a subset of this called var = subset
How do I make the next step - getting this subset into a html table or jquerymobile list on the browser screen?
I can see the data in the console log. I have been trying document.write but I can't get it to work.
My project is to put a sports prediction competition I run with a few friends onto a mobile friendly website. So eventually I ai mto have multiple subsets that I can then place into different tables or lists.
Thank you for any advice you can give. I am a complete novice at this.
Here is my code.
Code:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" />
<!-- <script src="/js/miso.ds.deps.min.0.4.1.js"></script> -->
<script src="http://cloud.github.com/downloads/misoproject/dataset/miso.ds.deps.ie.0.4.1.js"> </script>
<script src="http://code.jquery.com/jquery-1.8.2.min.js">
</script>
<script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js">
</script>
</head>
<title>testing data feeds</title>
</head>
<body>
<script language="javascript" type="text/javascript">
var ds = new Miso.Dataset({
importer: Miso.Dataset.Importers.GoogleSpreadsheet,
parser: Miso.Dataset.Parsers.GoogleSpreadsheet,
key: "0Ap-cOp8vqNpadG5GXzJsbmtRNlpObzhuRjIwanZfRWc",
worksheet: "1"
});
_.when(ds.fetch()).then(function(){
// create subset of just one row
var subset = ds.rows(function(row){
return (row.Qcode === 201205);
});
console.log("Subset length", subset.length);
console.log("Question number", subset.column("Qcode").data);
console.log("Matt ", subset.column("Matt").data);
console.log("Rob ", subset.column("Rob").data);
console.log("Paul ", subset.column("Paul").data);
console.log("Ross ", subset.column("Ross").data);
});
</script>
</body>
</html>
|