-
- "
- rownum = "<% $row %>"
- >
-
- |
-
-
- "
- rownum = "<% $row %>"
- >
-
- |
-
-
- "
-
- ><% $param->{"status$row"} %>
- "
- rownum = "<% $row %>"
- >
- "
- rownum = "<% $row %>"
- >
- |
-
-
- " rownum="<% $row %>">
-
-
-
- |
-
-
- <% $money_char %>
- <% $param->{"balance$row"} %>
-
- "
- rownum = "<% $row %>"
- >
- |
+ var <% $opt{prefix} %>total_el, <% $opt{prefix} %>rownum, <% $opt{prefix} %>totalrows, <% $opt{prefix} %>allrows;
+
+ function <% $opt{prefix} %>addDeleteButton (searchrow) {
+ var td_delete = document.getElementById('delete'+searchrow);
+ var button_delete = document.createElement('INPUT');
+ button_delete.setAttribute('rownum', searchrow);
+ button_delete.setAttribute('type', 'button');
+ button_delete.setAttribute('value', 'X');
+ button_delete.onclick = <% $opt{prefix} %>deleteRow;
+ button_delete.style.color = '#ff0000';
+ button_delete.style.fontWeight = 'bold';
+ button_delete.style.paddingLeft = '2px';
+ button_delete.style.paddingRight = '2px';
+ td_delete.appendChild(button_delete);
+ }
-% my $col = 0;
-% foreach my $field ( @{$opt{fields}} ) {
-% my $value;
-% if ( ref($field) eq 'CODE' ) {
-% $value = &{$field}($row,$param);
-% } else {
-% $value = $param->{"$field$row"};
-% }
-% my $name = (ref($field) eq 'CODE') ? "column${col}_$row" : "$field$row";
-% my $align = $align{ $opt{align}->[$col] || 'l' };
-% my $size = $sizes->[$col] || 10;
-% my $color = $opt{color}->[$col];
-% my $font = $color ? qq() : '';
-% my $onchange = '';
-% if ( $opt{onchange}->[$col] ) {
-% $onchange = 'onchange="'.$opt{onchange}->[$col].'"';
-% }
-% elsif ( $opt{footer}->[$col] eq '_TOTAL' ) {
-% $total[$col] += $value;
-% $onchange = $opt{prefix}. "calc_total$col();";
-% $onchange = qq(onchange="$onchange" onkeyup="$onchange");
-% }
-
-% my $type = $types->[$col] || 'text';
-% if ($type eq 'text' or $type eq 'checkbox') {
-
- >
-% } elsif ($types->[$col] eq 'immutable') {
- <% $font %><% $value %><% $font ? '' : '' %>
-
-% } else {
- Cannot represent unknown type: <% $types->[$col] %>
-% }
- |
-% $col++;
-% }
-
-% }
+ function <% $opt{prefix} %>newEmptyRow (searchrow) {
+ // add delete button to current row
+ <% $opt{prefix} %>addDeleteButton(searchrow);
+ // mark current row as non-empty
+ var oldemptyrow = document.getElementById('row'+searchrow);
+ oldemptyrow.emptyrow = false;
+ // update totalrows
+ <% $opt{prefix} %>totalrows++
+ <% $opt{prefix} %>updateTotalRow();
+ // add a new empty row
+ <% $opt{prefix} %>addRow();
+ }
-