Last active
September 7, 2016 03:35
-
-
Save somidad/05b298c45a77fe476a66c1c7508b775f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<head> | |
<script src="js/jquery-3.1.0.min.js"></script> | |
<script src="js/spreadcell.js"></script> | |
</head> | |
<body> | |
<div id="mlb"> | |
Loading content... | |
</div> | |
<script> | |
// prepare a callback funciton | |
var mlb_callback = function(obj) { | |
console.log(mlb) | |
$("#mlb").html("<table>") | |
$("#mlb table").css("border-collapse", "collapse") | |
$("#mlb table").append("<tr>") | |
for (var i = 0; i < mlb.header.length; i++) { | |
$("#mlb table tr:last-child").append("<td>") | |
$("#mlb table tr:last-child td:last-child").append(mlb.header[i]) | |
$("#mlb table tr:last-child td:last-child").css({"width": "75px", | |
"border-bottom": "2px solid #000", | |
"text-align": "center"}) | |
} | |
for (var i = 0; i < Math.min(mlb.body.length, 10); i++) { | |
$("#mlb table").append("<tr>") | |
for (var j = 0; j < mlb.body[i].length; j++) { | |
$("#mlb table tr:last-child").append("<td>") | |
$("#mlb table tr:last-child td:last-child").append(mlb.body[i][j]) | |
$("#mlb table tr:last-child td:last-child").css({"border-bottom": "1px solid #000", | |
"text-align": "center"}) | |
} | |
} | |
} | |
// retrieve a spreadsheet | |
var mlb = new SpreadCell({id: "17EwNIgGf9YqVUgl0WQftCJybGy2cYlKk7PKeJi0T3qU", | |
contain_header: true, | |
callback: mlb_callback}); | |
</script> | |
</body> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment