sqlquick
Tag
Attribute List:
This
tag indicates a "quick template". Most of its attributes are taken
directly from sqltemplate,
but there are several unique attributes to this tag indicating the
placement of various aspects of the template.
Type of tag: Open/close
Attributes
type
Required: Yes
Values: display | edit | add | mass-edit
Default: display
Indicates what kind of template you want to show. See sqltemplate.
Note that regular templates do not need the mass-edit value as this can be
detected by where the sqlaction
buttons are placed. However, since the buttons aren't placed in quick
templates, you'll have to define it specifically this way.
database
Required: No
Values: A valid database
Similar to
the "use db;" command in mySQL, this selects the default database for
the query. It's not required if you pass a MySQL connection directly to
Sparse when you call SparseThisPage()
or SparsePage()
.
tables
Required: Only if query
is not set
Values: The "table_references" for your SQL query.
Simple enough, just list the tables you want to deal with. You can use
the AS keyword for aliases, and can separate the tables by commas or
JOIN keywords etc.
query
Required: Only if tables
is not set
Values: Any valid SQL query
You
can create a template with a direct query using this attribute. This
allows for very complex queries, but the advanced functionality won't
be available - you can only use a
display
template.
limit
Required: No
Values: An integer number greater than 1. Note that this does not support "LIMIT
10, 15" syntax.
This
will allow you to limit the number of rows you want to display. In
other words, this is the number of rows which will be displayed per
page. You can add "Previous/Next" buttons using the sqlaction
tag
to allow the user to navigate around the rows. Note that this attribute
can be used even if you have a query
rather than table
defined.
constraints
Required: No
Values: Any valid WHERE/ORDER BY/GROUP BY/HAVING clause (all together).
This is the remainder of the query. See Templates
And Queries for more info. This attribute is ignored if you
have a query rather
than table
defined.
rowsToAdd
Required: No
Values: Valid positive integer
For add
templates, which have no data, you can indicate how many new
rows the user can insert at once by setting this attribute (e.g. if rowsToAdd
is 5,
the user will be shown 5 rows to insert). By default this is 1.
deleteTables
Required: No
Values: A comma-delineated list of table aliases
If your query has multiple tables, deleting a row from the template
will delete the row
from each
of the tables. To avoid this behavior, put a list of tables
in this attribute; only
these
tables will have their rows deleted. Note that you should use the
resolved name of the table; if you used an alias to define the table,
use the alias here.
style
Required: No
Values: A valid CSS style
Sets the style of the TABLE
tag which
the template will be embedded in.
class
Required: No
Values: A valid CSS class
Sets the class of the TABLE
tag which
the template will be embedded in.
search
Required: No
Values: A comma-delineated list of field aliases
If this attributte is provided, Sparse will print a search field and
button above the table which will search the given field(s). This is
analogous to the names
attribute of sqlsearch.
See Searching for more
info.
nav
Required: No
Values: above | below | none
Default: below
If this attribute is provided, Sparse will print an sqlnavigation
field either above or below the table. If it appears above the table
and the search
attribute is set, it will be below the search.
sort
Required: No
Values: A comma-delineated list of field aliases
If this attribute is provided, Sparse will print an sqlsort
field above the table. This will appear above the navigation (if it
exists) but after the search (if it exists).
rowError
Required: No
Values: true | false
Default: true
If this attribute is true, Sparse will print an sqlrowerror
tag above the table (it will appear below any sort, navigation, or
search fields).