.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Form::Control::table 3pm" .TH Form::Control::table 3pm "2023-01-22" "perl v5.36.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Embperl::Form::Control::table \- A table which get data from array of arrays or array of hashs .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 5 \& { \& type => \*(Aqtable\*(Aq, \& text => \*(Aqblabla\*(Aq, \& columns => [[\*(Aqfoo\*(Aq, \*(AqFoo item\*(Aq], \*(Aqbar\*(Aq], \& } .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" Used as a base class to create an table control inside an Embperl Form. See Embperl::Form on how to specify parameters. In most cases you need to overwrite this class and call the method show_table. show_table takes an arrayref of hashrefs or arrayref of arrays as parameter which is used as data to display. In case you have this data directly in \f(CW%fdat\fR you can use this control directly. .SS "\s-1PARAMETER\s0" .IX Subsection "PARAMETER" \fItype\fR .IX Subsection "type" .PP Needs to be 'table' .PP \fItext\fR .IX Subsection "text" .PP Will be used as label for the control .PP \fIcolumns\fR .IX Subsection "columns" .PP Arraryref which contains an arrayrefs with definition of columns names. Allows you to specify multiple rows per data entry. Column definition is either the key name in the data hashref or an arrayref with the name in the hash ref and the text to display as heading. Example: .PP .Vb 4 \& [ \& [[\*(Aqemail\*(Aq, \*(AqE\-Mail Address\*(Aq], [\*(Aqphone\*(Aq, \*(AqPhone\*(Aq]], \& [[\*(Aqfoo\*(Aq, \*(AqFoo\*(Aq], [\*(Aqbar\*(Aq, \*(AqBar\*(Aq]], \& ] .Ve .PP email and phone will be display on the first line with headings \&'E\-Mail Address' and 'Phone' and foo and bar will be displayed on the second line for each entry. In case your data is an array of arrays you have to specify the array index instead of the hash key name. .PP It is possible to add additional information. One entry might contain the following entries: .ie n .IP "0" 4 .el .IP "\f(CW0\fR" 4 .IX Item "0" Key for into data hashref .ie n .IP "1" 4 .el .IP "\f(CW1\fR" 4 .IX Item "1" Text to display .ie n .IP "2" 4 .el .IP "\f(CW2\fR" 4 .IX Item "2" Colspan (how many columns this cell should span) .ie n .IP "3" 4 .el .IP "\f(CW3\fR" 4 .IX Item "3" If set a control is displayed instead of a text. Must contain: .Sp radio,, or checkbox,, .ie n .IP "4" 4 .el .IP "\f(CW4\fR" 4 .IX Item "4" Display as link. This item contains the name of the key in the data hashref that holds the href. .ie n .IP "5" 4 .el .IP "\f(CW5\fR" 4 .IX Item "5" target for link .ie n .IP "6" 4 .el .IP "\f(CW6\fR" 4 .IX Item "6" Name of filter function. The value of the cell is process through this filter. Filter functions are passed as hashref of subs in the parameter 'filters' . .PP \fIline2\fR .IX Subsection "line2" .PP Arrayref with names of which the values should concated and displayed below each entry. .PP \fIfilters\fR .IX Subsection "filters" .PP Hashref of coderefs which contains filter functions. The following example shows one filter called 'date' which passes the data through the perl function format_date. The value is passed as first argument to the filter function. The second argument is the column description (see above), the third argument is the row data and the last argument is the current Embperl request record. .PP .Vb 7 \& filters => \& { \& \*(Aqdate\*(Aq => sub \& { \& return format_date ($_[0]) ; \& } \& } .Ve .SH "Author" .IX Header "Author" G. Richter (richter at embperl dot org) .SH "See Also" .IX Header "See Also" \&\fBperl\fR\|(1), Embperl, Embperl::Form