Please enable JavaScript to view this site.

Navigation: Advanced topics > Events > Table events

Events.After table initialized

Scroll Prev Next More

Description

The AfterTableInit event is executed upon loading each page before any processing takes place, right after the AfterAppInit event. Use this event to override any table-specific PHPRunner variables.

 

Check the description area in the Event editor to find the list of available table variables.

 

Note: It's not recommended to display anything on the web page from this event. This may break your application.

Applies to pages

All table specific pages like List, Print, Edit, Add, Export etc.

 

In this event you can use $table variable to access the name of the current table.

Example 1

To set the default records per page value to 10:

 

// tables and reports without group fields
$runnerTableSettings[$table]['pageSizeRecords'] = 10;
 
// tables and reports with group fields
$runnerTableSettings[$table]['pageSizeGroups'] = 10;

Example 2

This is how we can use $table variable to add Additional Where Tab programmatically:

 

Add the 'ANTON orders' tab:

 

WhereTabs::addTab($table,"CustomerID='ANTON'", "ANTON orders", "anton");

Example 3

Modify "Page size" selector options

 

// tables and reports without group fields
$runnerTableSettings[$table]['pageSizeSelectorRecords'] = array( 3, 5, 10, 20, 'all' );
 
// tables and reports with group fields
$runnerTableSettings[$table]['pageSizeSelectorGroups'] = array( 3, 5, 10, 20, 'all' );

 

Recommended  sample events

Dynamic SQL query

Add WHERE clause to the current SQL query

Replace WHERE clause of the current SQL query

Add a field name to the end of SELECT clause of the current SQL query

Remove a field name from the SELECT clause of the current SQL query

Replace field name in the SELECT clause of the current SQL query with new one

See also:

Choose pages screen

Datasource tables

After application initialized

About Database API

 

Created with Help+Manual 7 and styled with Premium Pack Version 3 © by EC Software