internal package
Foswiki::Tables::Table {specs}
- if given, the $specs
passed to the constructor (array)
{rows}
- array of Foswiki::Tables::Row
objects (or a subclass thereof)
{number}
- an identifier for this table in the sequence of tables in the topic. undef
until set by some external agency (e.g. the parser).
{colTypes}
- each column format is stored in the {colTypes} array. Entries in this array have the following fields: type
- the type e.g. text
, radio
size
- the (unverified) size, e.g. 1
, 10x8
(defaults to 20 for text
, 40x5
for textarea
and 1
for any other type)
initial_value
- everything after the second comma for text
, label
and date
. The empty string otherwise.
values
- array generated by treating everything after the second comma as a csv list.
{headerrows}
- number of header rows in the table. If no header rows are specified in the spec this will be undef
.
{footerrows}
- number of footer rows in the table. If no footer rows are specified in the spec this will be undef
.
ClassMethod
new($specs [, $supertag]) $specs
- array of tag specs that affect this table. Each spec is defined as follows: raw
is the string representation of the macro that apply to this table. Only required so that the table can be accurately serialised to TML.
tag
- simple string name of the tag
attrs
- Foswiki::Attrs for the tag. Note that these may have been heavily modified due to expansion of include
parameters.
$supertag
- optional tag that overrides all other tags
format
- The format of the cells in a row of the table. The format is defined like a table row, where the cell data specify the type for each cell. For example, format="| text,16 | label |"
. Cells can be any of the following types: text, <size>, <initial value>
Simple text field. Initial value is optional.
textarea, <rows>x<columns>, <initial value>
Multirow text box. Initial value is optional.
select, <size>, <option 1>, <option 2>, etc
Select one from a list of choices.
radio, <size>, <option 1>, <option 2>,
etc. Radio buttons. size
indicates the number of buttons per line in edit mode.
checkbox, <size>, <option 1>, <option 2>, etc
Checkboxes. size
indicates the number of buttons per line in edit mode.
label, 0, <label text>
Fixed label.
row
The row number, automatically worked out.
date, <size>, <initial value>, <DHTML date format>
Date. Initial value and date format are both optional.
headerrows
- integer number of rows in the thead
footerrows
- integer number of rows in the tfoot
extras
- optional Foswiki::Attrs hash of extra attributes
initsort
, sort
, disableallsort
ClassMethod
row_class() → $classname ClassMethod
getMacros() → @macronames ObjectMethod
finish() ObjectMethod
makeConsistent() ObjectMethod
totalRows() → $integer ObjectMethod
number([$set]) → $number ObjectMethod
stringify() ObjectMethod
getHeaderRows() → $integer ObjectMethod
getFooterRows() → $integer ObjectMethod
getID() → $id ObjectMethod
getFirstBodyRow() → $integer {rows}
; this is just the
index of the row if it does exist.
ObjectMethod
getLastBodyRow() → $integer {rows}
; this is just the
index of the row if it does exist, given the current size of
the table.
ObjectMethod
getCellData([$row [, $col]]) → $data $row
and $col
are given, return the scalar stored in that cell.
$row
is given, then return an array of the data in each column.
$row
nor $col
is given, return a 2D array of the cell data.
ObjectMethod
getLabelRow() → $rowobj undef
if there
is no label row.
ObjectMethod
addRow($row [, $newRow [, $any_row]]) → $rowObject $row
- 0-based index of the row to add after
* $newRow
- the row to add. A new row will be created using the
row_class if this is undefined. $any_row
- true to ignore header and footer constraints when adding rows.
$any_row
is false, the table will be made consistent (missing
header/footer rows added) before anything else is done.
Returns the new row.
ObjectMethod
isEditableRow($row) → $boolean $row
- 0-based index of the row to delete
* $any_row
- true to request deletion of header and footer rows
The row must exist. The row must be an editable row unless $any_row
is true.
If $any_row
is false, the table will be made consistent (missing
header/footer rows added) before anything else is done.
Returns true if the row was deleted.
ObjectMethod
moveRow($from, $to [, $any_row]) → $boolean $from
0-based index of the row to move
$to
0-based index of the target position (before $from
is removed!)
$any_row
- true to request moving of header and footer rows
$any_row
is true.
If $any_row
is false, the table will be made consistent (missing
header/footer rows added) before anything else is done.
If $to is outside the editable part of the table, the row will be moved
to the first or last editable position respectively.
Returns true if the move succeeded.
ObjectMethod
upRow($row [, $any_row]) → $boolean $row
0-based index of the row to move * $any_row
- true to request moving of header and footer rows
$any_row
is true.
If $any_row
is false, the table will be made consistent (missing
header/footer rows added) before anything else is done.
Returns 1 if the move succeeded.
ObjectMethod
downRow($row [, $any_row]) → $boolean $row
0-based index of the row to move * $any_row
- true to request moving of header and footer rows
$any_row
is true.
If $any_row
is false, the table will be made consistent (missing
header/footer rows added) before anything else is done.
Returns 1 if the move succeeded.
![]() |
© 2025 D.Soost & D.Marxsen - All rights reserved © Of all articles by authors Trademarks are the property of their respective owners © Logo by Wikipedia, modified by Administrator | Impressum Disclaimer Datenschutzerklärung |