NAME
Term::Fabulous::Event::PageChange - The user turned the page of a table or changed its page size
SYNOPSIS
$table->on( PageChange => sub ($event) {
load_more() if $event->page == $table->page_count;
return;
} );
DESCRIPTION
Term::Fabulous::Widget::Table fires PageChange on itself when the user turns to another page: with the buttons of its pager, Ctrl+PageUp or Ctrl+PageDown, or Ctrl+Home or Ctrl+End when the first or the last line is on another page. It also fires when the user chooses another page size in the pager, even when the page number stays the same.
Changing the page or the page size from your program ("page" in Term::Fabulous::Widget::Table, next_page, previous_page, "page_size" in Term::Fabulous::Widget::Table) fires nothing, and neither does the page following the cursor after the view changed (a filter, a sort, rows added or removed). Pages are explained in "PAGES" in Term::Fabulous::Manual::TableRows.
It is a Clay::UI::Events::Event whose name is PageChange; listen for it with $table->on( PageChange => 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::PageChange->new( page => ..., page_size => ... );
The table builds these events itself; build one yourself only to test your listeners. Unknown parameters die, and so does a missing page or page_size.
page-
See "page".
page_size-
See "page_size".
METHODS
page
The page shown now, counted from 1.
page_size
The number of lines per page (0: no pages).
SEE ALSO
Term::Fabulous::Widget::Table, "EVENTS" in Term::Fabulous::Manual::Events, "Split many rows into pages (pager and page sizes)" in Term::Fabulous::Cookbook::TableRows.