Table of Contents
- Introduction to Tabulators
- Creating a tabulator object
- Adding columns to a tabulator
- Adding rows to a tabulator
- Getting data from a tabulator
- Summarizing Tabulator data
The MU_Tabulator class implements an end-to-end method for displaying data in rows and columns. The tabulator class provides the following types of services:
Navigation services
Data caching
Data input
Summarization
The typical order of operation for using tabulator objects is:
Instanciate the tabulator object
Add columns
Add rows (if necessary)
Add the tabulator to a presentation object
The user then interacts with the tabulator. If it is a display only tabulator, you have no further responsibility. If the tabulator contains data input, the user will submit the tabulator and you:
Instanciate the tabulator object
Process selected or changed rows
It is not uncommon to instanciate the tabulator early in your page, check if the user did anything, and then perform appropriate actions in the script. Tabulators know two important pieces of information about themselves that facilitate this.
the action clicked by the user
the validation state
You should notice some points of particular interest from this example:
Tabulators are created by name.
A tabulator's name, the first parameter in the constructor, is important to using the tabulator. When you create a tabulator, it checks for any existing tabulator information of that name and, if found, uses it to initialize itself. That's how it finds its data, knows the user action, and knows if it is validated as soon as it is created.
Tabulators require a key.
The second paramter in the constructor is a key for the data in a particular tabulator. The key is related to row caching (see more below) and is used to indicate that the data displayed is for a different key, causing the cache to be cleared. For example, I have a list of classes which I can click on to a student roster. The tabulator name may be "class_roster" and the key is the CRN of the class. That way as each class is displayed, the tabulator knows when its data changes.
Actions are keyed on name.
Tabulator actions are referred to by name, first parameter in the add_user_action method. The display value of the action, the second paramter, is used internally.
Tabulators must be added to the presentation after they are built.
Unlike presentation elements, the tabulator object must be completely built before adding it to the presentation object. Once you have completed building the tabulator object, you add it to the presentation layer by calling the add_object method on the presentation element that will contain the tabulator (ie, the body), giving the tabulator as the paramter.
Please refer to the class documentation for MU_Tabulator for details about class attributes and methods.