[svn:p5ee] r3642 - p5ee/trunk/App-Widget/lib/App/Widget

[email protected]
Newsgroups perl.cvs.p5ee
Message-ID <[email protected]>
Author: spadkins
Date: Thu Mar  9 13:06:59 2006
New Revision: 3642

Modified:
   p5ee/trunk/App-Widget/lib/App/Widget/DataTable2.pm

Log:
finished true editing

Modified: p5ee/trunk/App-Widget/lib/App/Widget/DataTable2.pm
==============================================================================
--- p5ee/trunk/App-Widget/lib/App/Widget/DataTable2.pm	(original)
+++ p5ee/trunk/App-Widget/lib/App/Widget/DataTable2.pm	Thu Mar  9 13:06:59 2006
@@ -224,6 +224,18 @@
 # METHODS
 ######################################################################
 
+sub add_row {
+    &App::sub_entry if ($App::trace);
+    my ($self, $row) = @_;
+    my $add_data = $self->{add_data} || [];
+    push(@$add_data, $row);
+
+    $self->set("add_data", $add_data);
+    $self->set("mode", "edit");
+
+    &App::sub_exit() if ($App::trace);
+}
+
 sub get_columns {
     &App::sub_entry if ($App::trace);
     my $self = shift;
@@ -720,7 +732,7 @@
     return "No columns defined for table [$table]. (maybe it doesn't exist)" if (!$columns || $#$columns == -1);
     $headings          = $self->get_headings();
     $data              = $self->get_data();
-    my $compatibility     = $self->{compatibility}  || "";  # values: [HTML32]
+    my $compatibility  = $self->{compatibility}  || "";  # values: [HTML32]
     $startrow          = $self->{startrow}          || 1;
     $title             = $self->{title};
     $width             = $self->{width};
@@ -1030,16 +1042,16 @@
         }
         if ($mode eq "edit" && $column_selectable) {
             $html .= "<tr>\n";
-            $html .= "  <td bgcolor=\"#ffaaaa\">&nbsp;</td>\n" if ($numbered);
-            $html .= "  <td bgcolor=\"#ffaaaa\">&nbsp;</td>\n" if ($row_selectable);
-            $html .= "  <td bgcolor=\"#ffaaaa\">&nbsp;</td>\n" if ($row_single_selectable);
-            $html .= "  <td bgcolor=\"#ffaaaa\">&nbsp;</td>\n" if ($#row_actions > -1);
+            $html .= "  <td bgcolor=\"#ffaaaa\" class=\"App-DataTable-td_select\">&nbsp;</td>\n" if ($numbered);
+            $html .= "  <td bgcolor=\"#ffaaaa\" class=\"App-DataTable-td_select\">&nbsp;</td>\n" if ($row_selectable);
+            $html .= "  <td bgcolor=\"#ffaaaa\" class=\"App-DataTable-td_single_select\">&nbsp;</td>\n" if ($row_single_selectable);
+            $html .= "  <td bgcolor=\"#ffaaaa\" class=\"App-DataTable-td_select\">&nbsp;</td>\n" if ($#row_actions > -1);
             for ($col = 0; $col < $numcols; $col++) {
                 $column = $columns->[$col];
                 $elem = $context->widget("$name\{column_selected}{$column}",
                             class => "App::Widget::Checkbox",
                         )->html();
-                $html .= "  <td bgcolor=\"#ffaaaa\" valign=\"bottom\" align=\"center\">$elem</td>\n";
+                $html .= "  <td bgcolor=\"#ffaaaa\" valign=\"bottom\" align=\"center\" class=\"App-DataTable-td_select\">$elem</td>\n";
             }
             $html .= "</tr>\n";
         }
@@ -1097,7 +1109,7 @@
             $html .= "</td>\n";
         }
         else {
-            $html .= "  <td bgcolor=\"#ffaaaa\">&nbsp;</td>\n";
+            $html .= "  <td bgcolor=\"#ffaaaa\" class=\"App-DataTable-td_select\">&nbsp;</td>\n";
         }
     }
 
@@ -1129,7 +1141,7 @@
             $html .= "</td>\n";
         }
         else {
-            $html .= "  <td bgcolor=\"#ffaaaa\">&nbsp;</td>\n";
+            $html .= "  <td bgcolor=\"#ffaaaa\" class=\"App-DataTable-td_single_select\">&nbsp;</td>\n";
         }
     }
 
@@ -1175,8 +1187,12 @@
                 $column = $columns->[$col];
             }
 
-            if (($column ne "" && $self->{column_selected}{$column}) ||
-                ($self->{row_selected} && %{$self->{row_selected}})) {
+            # Removed because when a row is added without a selected row
+            # the inputs would be set to the minimum length
+            #if (($column ne "" && $self->{column_selected}{$column}) ||
+            #    ($self->{row_selected} && %{$self->{row_selected}})) {
+
+            if ($column ne "") {
                 for ($row = 0; $row <= $#$data; $row++) {
                     $elem = $data->[$row][$col];
                     if (defined $elem && length($elem) > $column_length[$col]) {
@@ -1187,6 +1203,7 @@
         }
 
         my $add_data = $self->{add_data};
+
         if ($add_data && $#$add_data > -1) {
             my ($errmsg, $row);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.