HTML-EditableTable
view release on metacpan or search on metacpan
example/example_1.cgi view on Meta::CPAN
'formElement' => 'textfield',
'callback' => \&cbTPSUid,
},
{
'dbfield' => 'zpg_ref',
'label' => 'ZPG Component Reference',
'formElement' => 'textfield',
'tooltip' => 'must be valid id from the Zorph database',
},
{
'dbfield' => 'project_name',
'label' => 'project name',
'tooltip' => 'poor project names will be punished',
},
{
'dbfield' => 'tpsid',
'label' => 'tps report #',
'formElement' => 'textfield',
},
{
'dbfield' => 'design_name',
'label' => 'design name',
'formElement' => 'textfield',
},
{
'dbfield' => 'project_owner',
'label' => 'owner',
'formElement' => 'popup',
'selectionList' => [1,2,3,4],
'selectionLabels' => {1=>'Andy', 2=>'Vishesh', 3=>'Vijay', 4=>'Sergei'},
'suppressCallbackOnEdit' => 1,
},
{
'dbfield' => 'project_type',
'label' => 'project type',
'formElement' => 'popup',
'selectionList' => ['PTV', 'NPI', 'Revision'],
},
{
'dbfield' => 'technology',
'label' => 'technology',
'formElement' => 'popup',
'selectionList' => [1,2,3,4],
'selectionLabels' => {1=>'lfet24', 2=>'cmos17up', 3=>'hdtyos', 4=>'cmos22soi'},
},
{
'dbfield' => 'manf_target',
'label' => 'internal/external manf',
'formElement' => 'popup',
'selectionList' => ['internal', 'external'],
},
{
'dbfield' => 'project_status',
'label' => 'project status',
'formElement' => 'popup',
'selectionList' => ['review', 'rejected', 'approved'],
},
{
'dbfield' => 'prod_date',
'label' => 'design prod (YYYY-MM-DD)',
'formElement' => 'calendar',
},
{
'dbfield' => 'ready_for_prod_time',
'label' => 'ready for prod date',
'viewOnly' => 1,
},
{
'dbfield' => 'comment',
'label' => 'comment',
'formElement' => 'textarea',
'editOnly' => 1,
}
);
######## CGI Controller ##########
our $t = CGI->new();
print $t->header();
print "<h3>" . "Example using EditableTable::Vertical" . "</h3>";
my $context = $t->param('context') || 'view';
# might be getting a context from command-line if the script is being run in the test suite
my %opts = ();
getopts('c:', \%opts);
if ($opts{c}) { $context = $opts{c}; }
my $table = HTML::EditableTable::Vertical->new();
$table->setTableFields(\@tableFields);
$table->setSortHeader('false');
$table->setData($data);
$table->setEditMode($context);
$table->setTitle('Products');
print "<form method=get>";
$table->htmlDisplay();
my $nextContext = $context eq 'view' ? 'edit' : 'view';
print "<input type=submit name=context value=$nextContext>";
print "</form>";
##################################
# calback which provides data to the table at runtime
sub cbTPSUid {
# table data available to the callback
my ($row, $colSpec, $editMode, $rowspanSubcounter) = shift @_;
return "<a href=example_1.cgi?context=view&id=$row->{tps_uid}>" . $row->{tps_uid} . "</a>";
}
( run in 0.357 second using v1.01-cache-2.11-cpan-39bf76dae61 )