Yast UI
YTable Class Reference

Multicolumn table widget. More...

Detailed Description

Multicolumn table widget.

Following widget variants exist: Table

The Table widget is a selection list with multiple columns. By default, the user can select exactly one row (with all its columns) from that list. With Opt(:multiSelection), the user can select one or more rows (with all their columns) from that list (In that case, use the :SelectedItems property, not :Value).

Each cell (each column within each row) has a label text and an optional icon.

(Note: Not all UIs (in particular not text-based UIs) support displaying icons, so an icon should never be an exclusive means to display any kind of information).

This widget is similar to SelectionBox, but it has several columns for each item (each row). If just one column is desired, consider using SelectionBox instead.

Note: This is not something like a spread sheet, and it doesn't pretend or want to be. Actions are performed on rows, not on individual cells (columns within one row).

The first argument (after Opt() and Id() which both are optional) is Header() which specifies the column headers (and implicitly the number of columns) and optionally the alignment for each column. Default alignment is left.

In the list of items, an ID is specified for each item. Each item can have less cells (columns) than the table has columns (from Header()), in which case any missing cells are assumed to be empty. If an item has more cells than the table has columns, any extra cells are ignored.

Each cell has a text label (which might also be an empty string) and optionally an icon. If a cell has an icon, it has to be specified with cell(Icon("myiconname.png", "Label text")).

A simple table is specified like this:

Table(Id(:players),
Header("Nick", "Age", "Role"),
[
Item(Id("Bluebird"), "Bluebird, 18, "Scout" ),
Item(Id("Ozzz" ), "Ozzz", 23, "Wizard" ),
Item(Id("Wannabe" ), "Wannabe", 17 ),
Item(Id("Coxxan" ), "Coxxan", 26, "Warrior")
]
)

This will create a 3-column table. The first column ("Nick") and the third column ("Role") will be left aligned. The second column ("Age") will be right aligned. note that "Wannabe" doesn't have a Role. This field will be empty.

A table that uses icons is specified like this:

Table(Id(:players),
Header("Nick", "Age", "Role"),
[
Item(Id("Bluebird"), "Bluebird, 18, cell(Icon("scout.png"), "Scout" ) ),
Item(Id("Ozzz" ), "Ozzz", 23, "Wizard" ),
Item(Id("Wannabe" ), "Wannabe", cell(Icon("underage.png", 17 ) ),
Item(Id("Coxxan" ), "Coxxan", cell(Icon("oldman.png", 26 ), "Warrior" )
]
)

In this example, "Bluebird" has an additional icon in his "Role" column, and "Wannabe" and "Coxxan" both have additional icons in their "Age" columns.


The documentation for this class was generated from the following file: