Skip to content

Table View

A table view shows a list of rows down the screen, like a Vertical Menu, but each row can be laid out in columns. Rows can be grouped under group rows (───── fsxNet ───── dividers), some rows can be made unselectable, a header can label the columns, and the list can be sorted by a column. The cursor keys, Page Up, Page Down, Home and End only ever land on rows that can be selected.

A table view without columns draws each row from itemFormat / focusItemFormat, so %TV can stand in for %VM.

Rows usually come from the module that owns the screen. A row is a string, or an object of fields. The fields keep their real types (numbers stay numbers, dates stay dates), so sorting and formatting work on the values themselves. A table view reads these fields of a row:

FieldDescription
kinditem (the default) or group. A group row is a divider drawn across the whole view from the group format
selectabletrue or false. Defaults to true for items and false for group rows. Navigation skips rows that cannot be selected. A table whose rows are all unselectable is read-only: its rows are drawn, nothing is highlighted, and the cursor keys scroll it
stateAny name the module chooses, e.g. new or personal. Picks a colour from stateSGR
keyA stable ID for the row, so focus stays on the same row when the list is refreshed. Falls back to data
dataThe value submitted with the form. When a row has no data, its index is submitted
textThe field shown when there are no columns and no itemFormat

Strings, and objects without these fields, behave as they do on a vertical menu.

In addition to the common view and menu view properties, a table view accepts:

PropertyDescription
columnsThe columns, keyed by an ID you choose. See Columns below
columnOrderColumn IDs in the order they are drawn, e.g. [ "flag", "area", "new" ]. A column left out is not drawn. Defaults to the order of columns
headertrue to draw a header row above the list (it takes one of the height rows). Defaults to false: many screens draw the header in the art instead
headerSGRColour of the header row, e.g. "|00|15"
headerFormatA format for the header row instead of the column labels. The module supplies its fields
separatorDrawn between columns, with its own colour, e.g. " |08│ "
focusSGRColour of the focused row (the lightbar), e.g. "|00|17". Defaults to the focus colour from the art
focusColumnsColumn IDs to highlight on the focused row. Defaults to the whole row. Both the lightbar and a column’s focusSGR apply only to these columns
altRowSGRColour added to every other row (zebra stripes). The stripes restart after each group row
stateSGRColour per row state, e.g. { new: "|15", personal: "|13" }
groupHow group rows are drawn: format (default {text}; sees every field of the group row), fillChar (may carry a colour: "|08─"), justify and sgr
emptyTextDrawn on the first row when there are no rows other than group rows (an empty list, or only group rows). Defaults to blank
sortThe sort, see Sorting below. Without sort, rows stay in the order the module gives them
sortableColumn IDs that the module’s “change sort” key cycles through. Defaults to every column drawn
sortIndicatorDrawn after the label of the sorted column in the header. Defaults to { asc: "▲", desc: "▼" } (CP437 0x1E / 0x1F)
focusItemAtTopIf true, the focused row is scrolled to the top. Defaults to false: the list scrolls as little as possible
itemFormat / focusItemFormatFormat of a row when there are no columns, as on a vertical menu. See Entry Formatting in MCI
textOverflowDrawn where a value is cut, e.g. "..". Applies to columns that do not set their own
plainFieldsFields whose pipe codes are shown as typed, e.g. [ "subject", "from.name" ]. The module usually sets these; a value set here replaces the module’s. See Pipe Codes below

Each entry in columns describes one column:

PropertyDescription
fieldThe row field shown. Defaults to the column ID
labelHeader label
typetext, number, date or bool. Worked out from the values when not set. Decides the default justification, how the column sorts, and how values are formatted
widthA number of columns, fill, or a percentage of the view width less the separators, e.g. "25%". fill columns (and columns without a width) share the space left over. When the numbers and percentages add up to more than the view, they shrink in proportion and fill columns get nothing
justifyleft, right or center. Numbers default to right, everything else to left
textOverflowDrawn where a value is cut: "..", "»", ">". Without it, values are simply cut. A marker wider than the column is cut to fit
fillCharFills the rest of the column. May carry a colour
paddingBlank columns inside the column, as a number (both sides) or [ left, right ]
formatA format for the value, e.g. "{value:,}". It sees {value} and every field of the row, and transformers such as {value!countAbbr} work. See Entry Formatting in MCI
dateFormatHow a date is shown, e.g. MMM DD. Defaults to the theme’s short date format
boolTextWhat a bool shows, as [ true, false ]. Defaults to [ "Yes", "No" ], also for an entry left out
nullTextShown when the value is empty (missing, null or ""). Defaults to blank
sgrColour of the column
focusSGRColour of the column on the focused row
pipeCodestrue or false: whether pipe codes in this column’s values are shown as colour. Overrides the module’s plainFields
minTermWidthHide the column on terminals narrower than this, e.g. 80. fill columns take the space it leaves, which helps on 40-column terminals
sortOrderasc or desc: the order used when the user’s sort key moves to this column. Defaults to asc
maxLinesWrap the value onto up to this many lines. Defaults to 1 (no wrap). See Wrapping below
rulesConditional colours and text, see Rules below

A date column takes a Date, a moment, an ISO 8601 string (2026-11-17T21:04:00) or epoch milliseconds from the module. Set type: date for the last two; only real dates are recognised without it. Any other value is shown as given.

A column with maxLines above 1 wraps its values onto several lines, at spaces; a word longer than the column is broken. A row is as tall as its tallest cell, each cell capped at its column’s maxLines, and the other cells of the row are padded with blank lines in their own colours. A value that needs more lines than maxLines ends its last line with the column’s textOverflow marker. Group rows and the header are always one line.

subject: {
field: subject
label: Subject
width: fill
maxLines: 2
textOverflow: ".."
}
  • The lightbar covers every line of the focused row (or of the focusColumns), and altRowSGR stripes whole rows.
  • Colours carry onto a cell’s wrapped lines; plain fields wrap as typed.
  • A row that does not fit whole at the bottom of the view is left for the next screen. When it is focused, the list scrolls to show all of it. A row taller than the whole view is shown from its top, cut at the bottom.
  • height counts screen lines, and Page Up / Page Down move by a screen of lines.

rules changes a cell’s colour, its text, or both, depending on its value:

new: {
field: newCount
label: New
type: number
width: 5
sgr: "|08"
rules: [
{
when: "> 0"
sgr: "|10"
}
{
when: "= 0"
text: "-"
}
]
}
  • when is empty, notEmpty, or one of =, !=, <, <=, >, >= followed by a value, e.g. "> 0", "= new", ">= 2026-11-01". Quote a value to keep spaces: "= 'no subject'".
  • Values compare by the column’s type:
    • numbers as numbers; the value after the operator must be a plain decimal (5, -2.5), not 0x10, 1e2 or Infinity
    • dates as dates; give an ISO 8601 date (2026-11-01) or date and time (2026-11-01T18:00:00). A date without a time means that whole calendar day, in the server’s time zone as the column shows dates: = 2026-11-17 matches any time that day, > 2026-11-17 means from the next day on
    • bool as true/false (yes/no, on/off, 1/0 also work, in the value and in the rule)
    • text ignoring case (and accents). = and != are otherwise exact (= 7 does not match 007); <, <=, >, >= use the order the column sorts in, where numbers inside text compare as numbers
  • Set the column’s type so a rule’s value can be checked when the menu loads; a value that does not read as that type, or a mistyped operator (== 5, <> 5, > =5), makes the rule invalid.
  • An empty value only matches empty; it never matches a comparison, not even !=. A value that does not read as the column’s type (n/a in a number column) never matches a comparison either.
  • The first rule that matches is used. A rule can have sgr, text or both.
  • sgr is the highest colour (see Colours below).
  • text is shown instead of the value: it is your text, so pipe codes show as colour, and it goes through the column’s format, justification and textOverflow like a value. It also replaces nullText for a rule that matches an empty value.
  • A rule whose when cannot be read is skipped. Each table view logs one warning, the first time it is set up (so once per visit to the screen), naming every rule it skipped.

A cell’s colour is built up in this order, each later colour overriding only what it sets:

  1. the view’s colour: focusSGR on the focused row, else the normal colour (plus altRowSGR on striped rows)
  2. the column’s sgr
  3. the row’s stateSGR
  4. the column’s focusSGR, on the focused row only
  5. the sgr of the first matching rule

Because the lightbar comes first, a column colour such as |03 stays visible inside it, and a rule’s colour (a lit “New” count) stays lit inside it; set the column’s focusSGR to change that. Colours inside a format or a value apply after all of these.

sort: {
column: new
order: desc
then: area
}
  • column is a column ID (or, for a field that has no column, the field name). order is asc (default) or desc. then is a tie-breaker column, or a list of them; each can be { column: area, order: desc }.
  • Rows are sorted within their groups: group rows stay where they are.
  • Numbers sort as numbers (9 before 10), dates by time, text without regard to case. Empty values always sort last, and so do values that do not fit the column’s type (e.g. n/a in a number column). In a column without a type, numbers come before dates, booleans and text.
  • sort: true sorts on text, as on a vertical menu.
  • A module can let the user change the sort with a key: it binds keys to the view’s cycleSort() (next column in sortable) and toggleSortOrder(). cycleSort() skips columns hidden by minTermWidth, even when sortable lists them.

Pipe codes in formats, labels, separator, group, emptyText and other text you write in the configuration are always shown as colour. Values in rows are shown as colour too, unless the module marks a field as plain: text typed by users (subjects, user names) is shown exactly as typed, so a |04 in a subject does not change colours. Control characters (such as an ESC sequence) are removed from plain fields. Plain fields can be nested (from.name) and are plain wherever they are formatted: in columns, group, itemFormat and headerFormat. A column’s pipeCodes overrides that either way: true shows the column’s codes as colour, false shows every value in it as typed.

  • Up and Down move to the next or previous row that can be selected, and wrap around at the ends of the list, as on a vertical menu.
  • Page Up and Page Down move by a screen of lines (rows can be taller than one line, see Wrapping). At the last row Page Down goes to the first, and at the first row Page Up goes to the last.
  • Home and End go to the first and last rows that can be selected.
  • A hot key that points at a row that cannot be selected is ignored.
  • When the list scrolls back up to the first row of a group, its group row is brought into view with it.
  • When nothing can be selected (an empty table, only group rows, or only unselectable rows), Enter submits null for the view’s argName; a module must expect it.
  • With no selectable rows but some item rows, the rows are drawn and the cursor keys scroll the table.

A list of message areas by conference, newest first:

Configuration fragment (expand to view)
TV1: {
height: 15
header: true
headerSGR: "|00|15"
separator: " |08│ "
focusSGR: "|00|17"
emptyText: "No new messages"
sort: {
column: new
order: desc
then: area
}
sortable: [ "area", "new", "last" ]
columnOrder: [ "flag", "area", "total", "new", "yours", "last" ]
columns: {
flag: {
field: newIndicator
width: 3
}
area: {
field: areaName
label: Area
width: fill
maxLines: 2
textOverflow: ".."
}
total: {
field: total
label: Total
type: number
width: 6
format: "{value:,}"
sgr: "|03"
}
new: {
field: newCount
label: New
type: number
width: 5
sgr: "|08"
rules: [
{
when: "> 0"
sgr: "|10"
}
{
when: "= 0"
text: "-"
}
]
}
yours: {
field: yours
label: Yours
type: number
width: 5
nullText: "-"
}
last: {
field: lastPostTs
label: Last Post
type: date
dateFormat: MMM DD
width: 9
minTermWidth: 80
}
}
group: {
format: "|08───── |15{confName} "
fillChar: "|08─"
}
stateSGR: {
new: "|15"
personal: "|13"
}
}

A table view is configured in menu.hjson and theme.hjson like any other view. In theme.hjson, the table view’s own object properties, columns, stateSGR, sort, group and sortIndicator, are merged with the menu’s, so a theme can change one column’s colour without repeating the table:

mci: {
TV1: {
columns: {
new: {
sgr: "|11"
}
}
sort: {
order: asc
}
}
}

Lists inside them are replaced as a whole: a theme that sets a column’s rules replaces that column’s rules list, and sort.then likewise. Every other property is replaced as usual.

A module fills the table and reacts to it through the view:

MethodDescription
setItems(rows, { keepFocus })Set the rows. With keepFocus: true focus stays on the same row (by key, else at the same index), moving to the nearest selectable row if that one cannot be selected now; without it focus goes to the first row that can be selected. A sort set with setSort() or cycleSort() is kept. Does not redraw
updateItem(key, fields)Merge fields into the row with this key (falling back to data; numbers are keys too) and redraw that row only (from that row down, if its height changes). Focus stays put; the list scrolls only when needed to keep the focused row whole, e.g. when a row above it grows. The row is not moved by the sort; call setSort() to re-sort. A change of kind or selectable redraws the table. Returns false if there is no such row
updateItemAt(index, fields)The same, by the row’s position on screen (after sorting)
getFocusedItem()The focused row, or null when nothing can be selected
findIndex(fn)Index of the first row for which fn(row, index) is true, else -1
focusNextMatching(fn, { wrap }) / focusPreviousMatching(fn, { wrap })Focus the next (previous) selectable row for which fn(row, index) is true, e.g. the next area with new messages. wrap defaults to true. Returns the index, or -1 with focus unchanged
setSort(column, order) / cycleSort() / toggleSortOrder() / getSort()Change or read the sort. setSort(null) goes back to the module’s order. Focus stays on the same row. A sort set this way stays in effect across setItems(). setSort() accepts a column hidden by minTermWidth, but the header has nowhere to show the indicator then
setDefaults({ … })The module’s own defaults for any table view property (columns, sort, group, textOverflow…). They sit beneath the menu and theme: built-in defaults < module defaults < menu.hjson < theme.hjson, with the same merge of columns and the other object properties. Call it before setItems()
setPlainFields([ … ])The module’s plain fields. An operator’s plainFields in menu.hjson or theme.hjson replaces them, and a column’s pipeCodes overrides both
setHeaderData({ … })Fields for headerFormat
  • getData() returns the focused row’s data whenever it is set, numbers included, else its index; null when nothing can be selected.
  • The index update event passes the row as a second argument: (index, row). It is not sent when nothing can be selected.
  • hotKeys refer to rows by their position on screen, after sorting.
  • setDefaults({ height }) (or any other view property) applies when neither the menu nor the theme sets it, so it overrides a height taken from the art.
  • removeItem(index) does not redraw, as on a vertical menu; call redraw().
  • The default width is the rest of the row from the view’s column, as for other views (79 on an 80-column terminal at column 2).
  • Like the other views, a table view does not lay itself out again when the caller’s terminal is resized during the screen: widths and minTermWidth use the size when the screen was drawn.
  • The focused row stays highlighted while another view has focus, as on a vertical menu.