Created
January 9, 2010 18:43
-
-
Save skyzyx/273034 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
(function() { | |
// Declare variables, and provide data to generate a table with. | |
var cols = ['col-1', 'col-2', 'col-3', 'col-4', 'col-5'], | |
cells = _.splitBy(['cell-1', 'cell-2', 'cell-3', 'cell-4', 'cell-5', 'cell-6', 'cell-7', 'cell-8', 'cell-9', 'cell-10', 'cell-11', 'cell-12'], cols.length); | |
var __ = DOMBuilder; | |
document.getElementById('demo03').appendChild(__.DOM([ | |
__('p').html('A table, generated programmatically with nested anonymous callbacks, from data.'), | |
__('table', { 'width':'20%', 'border':'1' }).child([ | |
__('thead').child( | |
__('tr').child(_.map(cols, function(c) { | |
return __('th').html(c); | |
})) | |
), | |
__('tbody').child(_.map(cells, function(tr) { | |
return __('tr').child(_.map(tr, function(td) { | |
return __('td').html(td); | |
})); | |
})) | |
]) | |
])); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment