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 | 06.11.2003 00:00:00 | 14.11.2003 00:00:00 | 15.11.2003 00:00:00 | Shipped | 0 | 324 | View Edit Remove | |
2 | 06.11.2003 00:00:00 | 15.11.2003 00:00:00 | 12.11.2003 00:00:00 | Shipped | 0 | 386 | View Edit Remove | |
3 | 07.11.2003 00:00:00 | 17.11.2003 00:00:00 | 12.11.2003 00:00:00 | Shipped | 0 | 344 | View Edit Remove | |
4 | 08.11.2003 00:00:00 | 16.11.2003 00:00:00 | 10.11.2003 00:00:00 | Shipped | 0 | Custom shipping instructions sent to warehouse | 242 | View Edit Remove |
5 | 11.11.2003 00:00:00 | 17.11.2003 00:00:00 | 13.11.2003 00:00:00 | Cancelled | 0 | Customer cancelled due to urgent budgeting | 496 | View Edit Remove |
6 | 11.11.2003 00:00:00 | 19.11.2003 00:00:00 | 14.11.2003 00:00:00 | Shipped | 0 | 171 | View Edit Remove | |
7 | 12.11.2003 00:00:00 | 19.11.2003 00:00:00 | 15.11.2003 00:00:00 | Shipped | 0 | 167 | View Edit Remove | |
8 | 12.11.2003 00:00:00 | 21.11.2003 00:00:00 | 18.11.2003 00:00:00 | Shipped | 0 | 124 | View Edit Remove | |
9 | 13.11.2003 00:00:00 | 22.11.2003 00:00:00 | 15.11.2003 00:00:00 | Shipped | 0 | We need to keep in close contact with their | 339 | View Edit Remove |
10 | 14.11.2003 00:00:00 | 22.11.2003 00:00:00 | 20.11.2003 00:00:00 | Shipped | 0 | 484 | View Edit Remove |