Created
December 28, 2012 23:28
-
-
Save MartijnR/4403057 to your computer and use it in GitHub Desktop.
table widget alternative
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
// var $row, | |
// $table = $('<table></table>'), | |
// $thead = $('<thead></thead>'), | |
// $tbody = $('<tbody></tbody>'), | |
// $header = $(this).find('.jr-appearance-label'), | |
// $content = $(this).find('.jr-appearance-list-nolabel'); | |
// | |
// $row = createRow($header, 'th'); | |
// $row.appendTo($thead); | |
// $thead.appendTo($table);// | |
// $content.each(function(){ | |
// $row = createRow($(this), 'td'); | |
// $row.appendTo($tbody); | |
// });// | |
// $tbody.appendTo($table); | |
// $table.appendTo($(this));// | |
// function createRow($fieldlist, cellType){ | |
// var $cell, | |
// $row = $('<tr/>'), | |
// $legend = $fieldlist.find('legend'); | |
// //legends have special built-in browser formatting so we remove them but keep the content | |
// $('<'+cellType+'>'+$legend.html()+'</'+cellType+'>').appendTo($row); | |
// $legend.remove(); | |
// //everything else can stay intact but is moved to table cells | |
// $fieldlist.find('label').each(function(){ | |
// $cell = $('<'+cellType+'/>'); | |
// $(this).detach().appendTo($cell); | |
// $cell.appendTo($row); | |
// }); | |
// return $row; | |
// } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment