Inheriting Table Properties
In this chapter we will make the
orders3.mql
file which inherits properties from
orders2.mql
file.
We will add the properties that we want to change or add.
On this page:
Setting Permissions
Because we want the new menu to have its own set of permissions we change the value of the
FUNZIONE
:
<%flags>
inherit => 'orders2.mql'
</%flags>
<%method FUNZIONE>Orders3</%method>
The corresponding menu should have identical
demo.orders.nome
value:
Adding a Field Method
The resulting
demo.orders
table contents will be shown by default in a form or consecutive records:
Note that we added the currency letter besides the price field with:
<%method price_FIELD><& /input/number.comp, %ARGS &>ÃÂ</%method>
If we want to show the records in a table we can set method
FORM_TYPE
to
TABLE
and add a couple of helper methods:
<%method FORM_TYPE>TABLE</%method>
<%method TABLE_ROWS>10</%method>
<%method ORDER>price, id</%method>
It is important that the sorting must be unique, otherwise the cache mechanism will report errors in the sorting of keys in the cache.
The default sorting for method
ORDER
is by a primary key:
<%method ORDER>order by <& SELF:KEY &></%method>
Here is the resulting table with rows sorted by
price
column:
Other possible
FORM_TYPE
values, besides
TABLE
, are
LINEAR
,
DIVS
and
TEMPLATE
. The latter
LINEAR
and
DIVS
are used less often. The
TEMPLATE
type is used in conjunction with
FORM_TEMPLATE
method.