* Please note this feature is only available in Premium and higher editions.
The master detail datagrid can be nested to show relationships for multilevel hierarchal data. The example shows only three levels, though the number of nested levels can be unlimited.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | // Always include namespace and conf.php on TOP of the script. use phpCtrl\C_DataGrid; require_once("/file/path/to/conf.php"); //suppliers master-detail $sg = new C_DataGrid("SELECT * FROM suppliers","supplierCode","suppliers"); $sg -> set_sql_key("supplierName"); //supplier detail2: products $sg_d1 = new C_DataGrid("SELECT productCode,productName,productDescription,quantityInStock,MSRP,productVendor FROM products","productCode","products"); //nested grid-level 3 for products $sg_d1_n1 = new C_DataGrid("SELECT * FROM productparts","productCode","productparts"); //set detail for products $sg_d1 -> set_masterdetail($sg_d1_n1, 'productCode'); //set detail 2 for suppliers $sg -> set_masterdetail($sg_d1, 'productVendor'); $sg -> display(); |
Note:
In the demo, click on #3 in suppliers grid first.
See Live Example! (In the demo, click on #3 in suppliers grid)