%doc> Example: include( '/elements/customer-table.html', ### # required ### #listrefs... 'header' => [ '#', 'Item' ], 'fields' => [ 'column', sub { my ($row,$param) = @_; $param->{"column$row"}; }, ], ### # optional ### 'name_singular' => 'customer', #label 'custnum_update_callback' => 'name_of_js_callback' #passed a rownum #listrefs 'types' => ['immutable', ''], # immutable or ''/text 'align' => [ 'c', 'l', 'r', '' ], 'size' => [], # sizes ignored for immutable 'color' => [], 'footer' => ['string', '_TOTAL'], # strings or the special #value _TOTAL 'footer_align' => [ 'c', 'l', 'r', '' ], 'param' => { column0 => 1 }, # preset column of row 0 to 1 ) %doc>
Inv # | Cust # | Status | Customer | Balance | % foreach my $header ( @{$opt{header}} ) {<% $header %> | % }|
---|---|---|---|---|---|---|
Total <% @rownums || 0 %> <% PL($opt{name_singular} || 'customer', ( @rownums || 0 ) ) %> | % my $col = 0; % foreach my $footer ( @{$opt{footer}} ) { % my $align = $align{ $opt{'footer_align'}->[$col] || 'c' }; % if ($footer eq '_TOTAL' ) { % my $id = $opt{'fields'}->[$col]; % $id = ref($id) ? "column${col}_TOTAL" : "${id}_TOTAL";<% sprintf('%.2f', $total[$col] ) %> | % } else {<% $footer %> | % } % $col++; % }