Nested tables
Example of table nesting
HIDE CODE
<?php $xcrud = Xcrud::get_instance(); $xcrud->table('orders'); $xcrud->default_tab('Order info'); $xcrud->parsley_active(true); //Make extension mandatory $xcrud->set_attr('comments',array('required'=>'required')); $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'); $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(); ?>
Orders
# | Orderdate | Requireddate | Shippeddate | Status | Action | Comments | Customernumber | |
---|---|---|---|---|---|---|---|---|
1 | 29.03.2003 00:00:00 | 19.03.2003 15:48:41 | 11.03.2003 00:00:00 | Shipped | 0 | Customer requested that FedEx Ground is used for | 486 | View Edit Remove |
2 | 18.03.2003 00:00:00 | 24.03.2003 00:00:00 | 20.03.2003 00:00:00 | Shipped | 0 | 187 | View Edit Remove | |
3 | 25.03.2003 00:00:00 | 31.03.2003 00:00:00 | 30.03.2003 00:00:00 | Shipped | 0 | 129 | View Edit Remove | |
4 | 24.03.2003 00:00:00 | 03.04.2003 00:00:00 | 29.03.2003 00:00:00 | Shipped | 0 | Customer requested that ad materials (such as | 144 | View Edit Remove |
5 | 26.03.2003 00:00:00 | 02.04.2003 00:00:00 | 27.03.2003 00:00:00 | Shipped | 0 | 124 | View Edit Remove | |
6 | 01.04.2003 00:00:00 | 24.04.2003 00:00:00 | 02.04.2003 00:00:00 | Shipped | 0 | 172 | View Edit Remove | |
7 | 04.04.2003 00:00:00 | 12.04.2003 00:00:00 | 07.04.2003 00:00:00 | Shipped | 0 | 424 | View Edit Remove | |
8 | 11.04.2003 00:00:00 | 19.04.2003 00:00:00 | 13.04.2003 00:00:00 | Shipped | 0 | 381 | View Edit Remove | |
9 | 16.04.2003 00:00:00 | 24.04.2003 00:00:00 | 17.04.2003 00:00:00 | Shipped | 0 | 148 | View Edit Remove | |
10 | 21.04.2003 00:00:00 | 29.04.2003 00:00:00 | 26.04.2003 00:00:00 | Shipped | 0 | Customer has worked with some of our vendors in | 216 | View Edit Remove |