* Please note this feature is only available in paid versions.
- $obj_grid: phpGrid object as subgrid
- $s_fkey: subgrid foreign key.
- $m_fkey: Optional. Master foreign key. (ver 4.5+).
- The method displays inline and read-only detail grid rather than in separate datagrid table. It is similar to set_masterdetail() except it can takes an additional parameter as the foreign key from master grid. When ignored, phpGrid assumes that m_fkey has the same value as the s_fkey.
Edit is currently not supported in subgrid. Nested subgrid is currently not supported,Nested/drill-down subgrid is now supported (version 6+).
- The order of the 2nd and 3rd parameter matters,
- When the subgrid is the same table(self-reference, in database term) as the master grid, subgrid must use an different alias as table name in the select statement.
- All the grid properties and method should be called BEFORE set_subgrid is called.
- Do not include ‘WHERE’ in set_query_filter() when used on subgrid.
- Due to the calling sequence, the enable_edit() should be called BEFORE set_subgrid() method, or edit properties will be ignored.
$dg = new C_DataGrid("SELECT * FROM orders", "orderNumber", "orders");
// 2nd grid as detail grid
$sdg = new C_DataGrid("SELECT * FROM orderdetails", array("orderLineNumber", "productCode"), "orderdetails");
// 3rd grid as detail grid.
$sdg2 = new C_DataGrid("SELECT * FROM products", array("productCode"), "products");
// passing the detail grid object as the first parameter, then the foreign key name.
// set_subgrid should be the last method to call before display