Skip to content

Instantly share code, notes, and snippets.

@MartijnR
Created December 28, 2012 23:28
Show Gist options
  • Save MartijnR/4403057 to your computer and use it in GitHub Desktop.
Save MartijnR/4403057 to your computer and use it in GitHub Desktop.
table widget alternative
// 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