Nested Tables: Bottom & Bottom-Fixed
Two position() values that keep a nested table always visible below the parent's own fields, instead of hidden behind a tab click.
position('bottom')
Renders the nested table as a full-width section appended directly below the parent form's own fields (or below the tab strip, if the same form also has other nested_table() children still using the default tab position - every placement coexists freely on one form). No tab click is needed to see it:
$xcrud = Xcrud::get_instance();
$xcrud->table('orders');
$xcrud->route('orders');
$xcrud->columns('orderNumber,orderDate,status,customerNumber');
$orderdetails = $xcrud->nested_table('Order details', 'orderNumber', 'orderdetails', 'orderNumber');
$orderdetails->columns('productCode,quantityOrdered,priceEach');
$orderdetails->fields('productCode,quantityOrdered,priceEach');
$orderdetails->order_by('productCode', 'asc');
$orderdetails->position('bottom');
echo $xcrud->render();
Opening an order's edit form now shows "Order details" as a heading with its own grid right below the order's own fields - scrolling through the form scrolls the nested section away along with everything above it.
position('bottom-fixed')
The sticky sibling of bottom: the same section, but pinned (CSS position: sticky) to the bottom of the form's own scrolling panel as the visitor scrolls through the fields above it - staying reachable without scrolling all the way down. It defaults to 35% of the viewport height (min-height: 90px, max-height: 70vh), with a draggable grip-bar handle at its own top edge to resize it, and its own internal scroll for the child rows so it never has to grow to show everything at once.
The difference from the example above is a single line:
$orderdetails->position('bottom-fixed');
Full example, matching pages/nested-table-bottom-fixed.php:
$xcrud = Xcrud::get_instance();
$xcrud->table('orders');
$xcrud->route('nested-table-bottom-fixed');
$xcrud->columns('orderNumber,orderDate,status,customerNumber');
$orderdetails = $xcrud->nested_table('Order details', 'orderNumber', 'orderdetails', 'orderNumber');
$orderdetails->columns('productCode,quantityOrdered,priceEach');
$orderdetails->fields('productCode,quantityOrdered,priceEach');
$orderdetails->order_by('productCode', 'asc');
$orderdetails->change_type('priceEach', 'price', '2', ['prefix' => '$']);
$orderdetails->relation('productCode', 'products', 'productCode', 'productName', null, null, false, ' ', true);
// The one line that differs from plain 'bottom'.
$orderdetails->position('bottom-fixed');
echo $xcrud->render();
Open the order's edit form and scroll through its own fields - "Order details" stays pinned near the bottom of the panel the whole time, instead of scrolling away with the rest of the form the way plain bottom does. Drag the handle bar at its own top edge up or down to resize it.
position() reference
| Value | Description |
|---|---|
bottom | Always-visible, full-width section below the parent's own fields; scrolls with the page |
bottom-fixed | Same section, sticky-pinned near the bottom, ~35% height by default, draggable resize handle, internal scroll |