Using Table Browser

Generic Browser is a module for presenting data in a table. It's useful for showing database query results, or anything else that's naturally rows and columns — a multiplication table, for instance.

Usage

First, init the Utils/GenericBrowser module:

$gb = &$this->init_module('Utils/GenericBrowser', null, 'table\'s name');

The third argument identifies the table. The second argument isn't explained further in this guide beyond being passed as null here — flagged during the August 2026 documentation review for someone with framework access to fill in.

Once GenericBrowser is initialized, set its columns:

$gb->set_table_columns(
    array(
        array('name'=>'Row number', 'width'=>60),
        array('name'=>'header 2', 'width'=>5),
        array('name'=>'last header', 'width'=>25)
    )
);

This gives the table three columns — the first widest, the middle one narrowest. You're not limited to three columns; add as many as you need.

Now populate the table with rows:

for( $i = 0; $i < 10; $i++) {
    $gb->add_row( 'Row '.$i, 'narrow', 'last' );
}

The number of arguments you pass to add_row() must match the number of columns you defined — otherwise you'll get an error.

To display the table:

$this->display_module( $gb );