isMSo
sqlsort
Tag
Attribute List:
This tag displays a form which allows users to sort the data. There are
several ways to customize the behavior of the form. You can present to
the user a customized list of fields, customize the labels for each
field, and allow multiple levels of sorting.
This tag must be outside the sqlrow tag.
See Sorting in the documentation for more details.
Type of tag: Self-closing
Attributes
names
Required: No
Values: A comma-delineated list of field aliases
This is basically a list of sqlfield
name attributes. See sqlfield
for more details. These names will populate the select box for "field to sort by" - but only the values of each option. See the labels attribute for more info.
If this attribute is not present, all fields displayed in this template will populate the select box.
labels
Required: No
Values: A comma-delineated list of strings
These are the labels that will appear in the field select box - in other words, the content of the OPTION tags. Make sure that this attribute has the same number of elements as the names attribute has; if they don't line up, the select box may look weird. If the names attribute is not present, the labels attribute is ignored.
Note that this attribute allows the use of quotes to keep names together; for example, this is fine:
<sqlsort names="name, birthdate" labels='"my name", "this,that"'>
order
Required: No
Values: asc | desc | both
Default: both
This indicates what order you want the sorting to be in. Asc means ascending order, desc means descending order. Both creates a second select box for each level asking the user whether it should be ascending or descending order.
Note that there is no way to automatically make the first level ascending and the secone level descending, or vice versa.
levels
Required: No
Values: Any positive integer
Default: 1
This indicates how many levels to allow the user to sort by. 2 levels
means that two select boxes will be printed out - first the data will
be sorted by the first box, then the second one. This is equivalent to
using the query "ORDER BY field1, field2".
style
Required: No
Values: Any CSS style declaration
Works like any other style declaration. However, because there are
three elements inside this tag (text, select boxes, and buttons) it's
best to simply give it a single class definition, and then use
declarations like .mySort input[type="button"]
.
class
Required: No
Values: Any CSS class name
Works like any other class declaration. See style.