The fastest easiest way to get it right.

Child Tables In The Conventional Profile

The real power of the conventional profile is its handling of child tables. The conventional profile displays all child tables in a tab list at the bottom of the detail area:

Clicking on one of the tabs causes the browser to make a JSON call to the server to retrieve the matching rows in the child table:

Removing a Child Table

If you do not wish to have a child table displayed this way, set the 'x6display' property of a foreign key to 'none', as in this example:

table childexample:
    module: testing
    description: Example Child Table
    
    foreign_key parent:
        x6display: none

This can be overridden in program code by making a dictionary override function for the parent table that modifies properties of its children:

<?php
# This is file application/applib.php
#
function ddTable_parent(&$dd) {
    # To remove a table:
    $dd['fk_children']['childexample']['x6display'] = 'none';
    
    # Or to put a table back in:
    $dd['fk_children']['childexample']['x6display'] = '';
}
?>

Choosing the Columns to Display

By default, Andromeda looks at the uisearch columns when deciding which columns to display. This can be overridden by defining a projection on the child table named "child_" + parent table. Here is a YAML example:

table orderlines:
    module: ordering
    nomenu: Y
    
    projection child_orders:
        column item:
        column qty:
        column price:
        column price_extended:

Or we can do the same thing in program code. Program code always overrides YAML settings:

<?php
# This is file application/applib.php
#
function ddTable_orderlines(&$dd) {
    $dd['projections']['child_orders'] = 'item,qty,price,price_extended';
}
?>

Making a Child Table Editable

If a child table is simple, having only a few columns, you can make the grid itself directly editable, with this YAML definition:

table orderlines:
    module: ordering
    x6childwrites: Y

Or this program code:

<?php
# This is file application/applib.php
#
function ddTable_orderlines(&$dd) {
    $dd['x6childwrites'] = 'Y';
}
?>

Making More Complex Child Tables Editable

It may be that a child table should be editable, but it has more columns than will fit onto the grid. In these cases you can set x6childwrites to "detail", and when the user clicks on a row or clicks on [NEW] a detail pane pops up for editing.

The syntax is exactly the same as the above example, simply use the value 'detail' instead of 'Y'.

comments powered by Disqus
Home |  Documentation |  Download |  Credits |  Contact |  Login
Andromeda © Copyright 2004-2013, Licensed under the GPL Version 2