Help And Documentation

2: Object Reference

2.9: The Results Table Object

A Table object is used to generate an HTML table using data from a Database Query object or an array. It provides formatting fields for you to change the HTML which surrounds your table headings and values and also automatic pagination.

If you are using a Database Query as your source of data then there are also additional features such as generating a search form above the table and clickable order by links in the column headings.


Use Database Query

This method can only be used once.

This method can be used to set a data variable.

This method allows you to provide a Database Query object so that you can use its data to populate the table which is generated by this object. The data from each row will be put into a data variable as an array with whatever name you set using this method.

If you do not provide a data variable name then all of the individual fields from the database results will be set as data variables with the same name. This can be convenient but might overwrite other variables that you have already set for other purposes.

As the database rows are looped over, the data of each row will be set as data variables as described above before executing the content that you have added using the 'Add Column' method.

Parameters

Name Text Variable Object Array
Sql No No Yes No
Set Result Row Array Yes No No No

Use Array Values

This method can only be used once.

This method can be used to set a data variable.

This method allows you to provide an array so that you can use its data to populate the table which is generated by this object. The index and value or each row will be set as data variables with the names that you set using this method.

As the array elements are looped over, the index and value of each array element will be set as data variables before executing the content that you have added using the 'Add Column' method.

Parameters

Name Text Variable Object Array
Array No Yes Yes Yes
Set Index Data Yes No No No
Set Value Data Yes No No No

Add Column

This method can be used multiple times.

This method can be used to add content that is executed and displayed while looping over the data that has been provided to this object. The header content will only be displayed once in an initial header row. If no columns are found with a header value then the initial header row will not be displayed.

If you need the content of your column to display a mix of text/HTML and data variables then you will need to add a Content object to the content parameter and add your mix of text/HTML and data variables content to that new Content object.

Parameters

Name Text Variable Object Array
Header Yes Yes Yes No
Content Yes Yes Yes No

No Results Content

This method can only be used once.

Use this method to add content that will be displayed if no data was supplied to this object by any Database Query object or array that might have been set.

Parameters

Name Text Variable Object Array
Content Yes Yes Yes No

Search Fields

This method can be used multiple times.

This method can be used to add a form above your table which will automatically search and filter the results that are returned by the Database Query object that has been added to this object. This method will not have any effect if you are using array values as the data source of this object.

Parameters

Name Text Variable Object Array
Label Yes No Yes No
Field Yes No No No
Type Yes No No No
After Yes No Yes No

Add Search Value

This method can be used multiple times.

This method can be used to add values as options if you have a search field which generates a drop-down (select) box or radio buttons. This method will not have any effect if you are using array values as the data source of this object.

Parameters

Name Text Variable Object Array
Field Yes No No No
Type Yes No No No
Name Yes No Yes No
Value Yes No Yes No

Add Search Query

This method can be used multiple times.

This method can be used to add values as options if you have a search field which generates a drop-down (select) box or radio buttons. It does this by taking the database result and using the first field it finds as the value and the second field it finds as the label to display. This method will not have any effect if you are using array values as the data source of this object.

Parameters

Name Text Variable Object Array
Field Yes No No No
Type Yes No No No
Database Query No No Yes No

Order Result Links

This method can be used multiple times.

This method can be used to generate links in the initial header row which will automatically sort the data of the database result after they are pressed. This method will not have any effect if you are using array values as the data source of this object.

Parameters

Name Text Variable Object Array
Column Yes No No No
Name Yes No No No
Field Yes No No No
Direction Yes No No No

Pagination Links

This method can only be used once.

This method can be used to automatically separate your data into pages and generate page links after the table has been generated. Using this method will override the default site formatting values.

Parameters

Name Text Variable Object Array
Rows per page Yes No Yes No
Number of links Yes No Yes No
Before Pagination Yes No Yes No
After Pagination Yes No Yes No
Before a link Yes No Yes No
After a link Yes No Yes No
Before the current page link Yes No Yes No
After the current page link Yes No Yes No
First page link Yes No Yes No
Previous page link Yes No Yes No
Next page link Yes No Yes No
Last page link Yes No Yes No

Set Formatting

This method can only be used once.

This method can be used to specify the HTML which formats the search form and rows of data that are generated by this object. You can also supply any value to the final two parameters to tell this object not to show an initial header row or search form. Using this method will override the default site formatting values.

Parameters

Name Text Variable Object Array
Before the results Yes No Yes No
Before a result row Yes No Yes No
Before header content Yes No Yes No
After header content Yes No Yes No
Before column content Yes No Yes No
After column content Yes No Yes No
Between column content Yes No Yes No
After a row result Yes No Yes No
Between result rows Yes No Yes No
After the results Yes No Yes No
Form CSS class Yes No Yes No
Before search fields Yes No Yes No
Before a label Yes No Yes No
After a label Yes No Yes No
Before a search field Yes No Yes No
After a search field Yes No Yes No
Between search fields Yes No Yes No
After search fields Yes No Yes No
Select Value Text Yes No Yes No
Search field CSS class Yes No Yes No
Search Button Yes No Yes No
No Headers Yes Yes Yes No
No Search Form Yes Yes Yes No

Next Page » « Previous Page