NAME

Term::Fabulous::Event::Collapse - The user closed a row or a group of a table

SYNOPSIS

$table->on( Collapse => sub ($event) {
	say 'closed ', defined $event->row_id ? 'row ' . $event->row_id : "group @{ $event->group_path }";
	return;
} );

DESCRIPTION

Term::Fabulous::Widget::Table fires Collapse on itself when the user closes an open tree row (hiding its children) or an open group: with a click on the marker in front of it or, for a group, anywhere on its header; with Left or - on it; or with Enter or Space on a group header. A click fires it after the Term::Fabulous::Event::CursorMove the click causes.

Closing from your program (collapse, collapse_all, collapse_group, collapse_all_groups) fires nothing. Its counterpart is Term::Fabulous::Event::Expand. Groups and trees are explained in "Opening and closing groups" in Term::Fabulous::Manual::TableRows and "Opening and closing tree rows" in Term::Fabulous::Manual::TableRows.

It is a Clay::UI::Events::Event whose name is Collapse; listen for it with $table->on( Collapse => sub ($event) { ... } ). It bubbles to the table's ancestors like every event (see "Return values and bubbling" in Term::Fabulous::Manual::Events), and $event->target is the table.

CONSTRUCTOR

new

my $event = Term::Fabulous::Event::Collapse->new( row_id => ..., group_path => ... );

The table builds these events itself; build one yourself only to test your listeners. Unknown parameters die, and so does a group_path that is not undef or an array reference; it is copied.

row_id

See "row_id".

group_path

See "group_path".

METHODS

row_id

The id of the row that was closed, or undef for a group.

group_path

For a group, the values of the group and of the groups around it, outermost first (a new array reference); undef for a row.

SEE ALSO

Term::Fabulous::Widget::Table, "EVENTS" in Term::Fabulous::Manual::Events, "Group rows by a column (collapsible group headers)" in Term::Fabulous::Cookbook::TableRows, "Show nested data as a tree (expand and collapse rows)" in Term::Fabulous::Cookbook::TableRows.