* Please note this feature is only available in paid versions.
phpGrid supports a master grid with multiple detail grids. There is no limit on how many detail grids a master datagrid can have. Detail grids are defined the way as the master datagrid does. Click on example link to see it in action!
Note that you can have master and detail grids from the same database table as long as different SQL alias are used.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | // 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 detail 1: product lines $sg_d1 = new C_DataGrid("SELECT * FROM supplierproductlines","supplierCode","supplierproductlines"); $sg->set_masterdetail($sg_d1, 'supplierName'); //supplier detail2: products $sg_d2 = new C_DataGrid("SELECT productCode,productName,productDescription,quantityInStock,MSRP,productVendor FROM products","productCode","products"); //set detail 2 for suppliers $sg->set_masterdetail($sg_d2, 'productVendor'); $sg->display(); |