MarkupAdminDataTable class

Module that provides an API for rendering of HTML tables in the ProcessWire admin (or elsewhere)

This module provides a consistent way for rendering <table> elements in the ProcessWire admin. It can certainly be used outside of the admin as well, but it gets its default classes from those defined by the admin theme. For example, if your system uses AdminThemeUikit then this module will use uk-table classes.

$table = $modules->get('MarkupAdminDataTable');
$table->setSortable(true);
$table->headerRow([ 'First name', 'Last name', 'Email' ]);
foreach($people as $person) {
  $table->row([ $person->first_name, $person->last_name, $person->email ]);
}
echo $table->render();

This module populates $config->styles and $config->scripts with its MarkupAdminDatable.css and MarkupAdminDataTable.js files.


Click any linked item for full usage details and examples. Hookable methods are indicated with the icon. In addition to those shown below, the MarkupAdminDataTable class also inherits all the methods and properties of: ModuleJS, WireData and Wire.

Show $var?     Show args?       Only hookable?    

Content

NameReturnSummary 
$table->footerRow(array $a)
self

Set the footer row for the table


Can also be used as property: $table->footerRow
 
$table->headerRow(array $a)
self

Set the header row for the table


Can also be used as property: $table->headerRow
 
$table->render()
string

Render the table

$table->row(array $a)
self

Add a row to the table (see arguments for details)

 
$table->setCaption(string $caption)
None

Set table caption

 

Properties

NameReturnSummary 
$table->actions array Action buttons for under the table 
$table->border int Table border attribute 
$table->caption string Content for table <caption> tag.  
$table->class string Class attribute for <table> element 
$table->encodeEntities bool Should table content be entity encoded? Set to false if already encoded.  
$table->id string HTML id attribute for table 
$table->resizable bool Should table be resizable? 
$table->responsive bool Use responsive mode? 0=off, 1=responsive, 2=responsive stack 
$table->rowAttrs array Attributes for table rows indexed by row number (0 is first) 
$table->rowClasses array Classes for table rows indexed by row number (0 is first) 
$table->rows array Table rows 
$table->settings array Array of table settings 
$table->sortable bool Should table be sortable? 

Additional methods and properties

In addition to the methods and properties above, MarkupAdminDataTable also inherits the methods and properties of these classes:

API reference based on ProcessWire core version 3.0.255