Permalink
Browse files

Update table elements to emit thead, tbody, and tfoot tags.

  • Loading branch information...
1 parent a3a9f89 commit 2ac0995c66b5239f00a88146c63f9fd7cdbeb5bc @rustyio rustyio committed Jun 29, 2010
Showing with 15 additions and 3 deletions.
  1. +1 −1 apps/nitrogen/include/wf.hrl
  2. +14 −2 apps/nitrogen/src/elements/table/element_table.erl
@@ -97,7 +97,7 @@
-record(spinner, {?ELEMENT_BASE(element_spinner), image="/nitrogen/spinner.gif"}).
-record(image, {?ELEMENT_BASE(element_image), image="", alt}).
-record(lightbox, {?ELEMENT_BASE(element_lightbox), body="" }).
--record(table, {?ELEMENT_BASE(element_table), rows}).
+-record(table, {?ELEMENT_BASE(element_table), rows, header=[], footer=[]}).
-record(tablerow, {?ELEMENT_BASE(element_tablerow), cells}).
-record(tableheader, {?ELEMENT_BASE(element_tableheader), text="", html_encode=true, body="", align="left", valign="middle", colspan=1, rowspan=1}).
-record(tablecell, {?ELEMENT_BASE(element_tablecell), text="", html_encode=true, body="", align="left", valign="middle", colspan=1, rowspan=1}).
@@ -9,9 +9,21 @@
reflect() -> record_info(fields, table).
render_element(Record) ->
- Rows = Record#table.rows,
- wf_tags:emit_tag(table, Rows, [
+ Header = case Record#table.header of
+ [] -> "";
+ _ -> wf_tags:emit_tag(thead, Record#table.header, [])
+ end,
+
+ Footer = case Record#table.footer of
+ [] -> "";
+ _ -> wf_tags:emit_tag(tfoot, Record#table.footer, [])
+ end,
+
+ Body = wf_tags:emit_tag(tbody, Record#table.rows, []),
+ Content = [Header, Footer, Body ],
+
+ wf_tags:emit_tag( table, Content, [
{border, 0},
{cellpadding, 0},
{cellspacing, 0},

0 comments on commit 2ac0995

Please sign in to comment.