Nested tables in tabs Bootstrap 5 theme
Example of table nesting in tabs implementation
HIDE CODE
<?php
$xcrud = Xcrud::get_instance();
$xcrud->table('orders');
$xcrud->default_tab('Order info');
$xcrud->title_columns("<span style='border: 1px solid #e5e5e5;
padding: 5px;
display: block;
margin-bottom: 6px;'><b> Order Number: {orderNumber}</b><br><b> Customer Number: {customerNumber}</b></span>");
$orderdetails = $xcrud->nested_table('Order details','orderNumber','orderdetails','orderNumber'); // 2nd level
$orderdetails->columns('productCode,quantityOrdered,priceEach');
$orderdetails->fields('productCode,quantityOrdered,priceEach');
$orderdetails->default_tab('Detail information');
$orderdetails->order_by("productCode","asc");
//$orderdetails->limit(1000);
$customers = $xcrud->nested_table('Customers','customerNumber','customers','customerNumber'); // 2nd level 2
$customers->columns('customerName,city,country');
$products = $orderdetails->nested_table('Products','productCode','products','productCode'); // 3rd level
$products->default_tab('Product details');
$productLines = $products->nested_table('Product Lines','productLine','productlines','productLine'); // 4th level
echo $xcrud->render();
?>
<script>
$('.xcrud-tabs .menu .item').tab('change tab','tab1.php');
</script>
Orders
| # | Orderdate | Requireddate | Shippeddate | Status | Comments | Customernumber | |
|---|---|---|---|---|---|---|---|
| 1 | 01.07.2003 00:00:00 | 10.07.2003 00:00:00 | 05.07.2003 00:00:00 | Shipped | gfchchf rtrtyrty | 250 | View Edit Remove |
| 2 | 02.07.2003 00:00:00 | 12.07.2003 00:00:00 | 03.07.2003 00:00:00 | Shipped | NULL | 124 | View Edit Remove |
| 3 | 01.08.2003 00:00:00 | 09.08.2003 00:00:00 | 04.08.2003 00:00:00 | Shipped | www | 334 | View Edit Remove |
| 4 | 19.09.2003 00:00:00 | 27.09.2003 00:00:00 | 21.09.2003 00:00:00 | Shipped | They want to reevaluate their terms agreement | 148 | View Edit Remove |
| 5 | 21.09.2003 00:00:00 | 30.09.2003 00:00:00 | 24.09.2003 00:00:00 | Shipped | 311 | View Edit Remove | |
| 6 | 25.09.2003 00:00:00 | 03.10.2003 00:00:00 | 01.10.2003 00:00:00 | Shipped | 333 | View Edit Remove | |
| 7 | 28.09.2003 00:00:00 | 05.10.2003 00:00:00 | 03.10.2003 00:00:00 | Shipped | 141 | View Edit Remove | |
| 8 | 02.10.2003 00:00:00 | 12.10.2003 00:00:00 | 08.10.2003 00:00:00 | Shipped | 219 | View Edit Remove | |
| 9 | 06.10.2003 00:00:00 | 13.10.2003 00:00:00 | 07.10.2003 00:00:00 | Shipped | 186 | View Edit Remove | |
| 10 | 08.10.2003 00:00:00 | 17.10.2003 00:00:00 | 11.10.2003 00:00:00 | Shipped | 141 | View Edit Remove |