set_subgrid()

  • Parameter(s):
    • $obj_grid: phpGrid object as subgrid
    • $s_fkey: subgrid foreign key.
    • $m_fkey: Optional. Master foreign key. (ver 4.5+).
  • Description:
    • 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.
  • Remark:
    • Edit is currently not supported in subgrid.
    • Nested subgrid is currently not supported.
    • The 3rd parameter is only available to version 4.5 and above.
    • 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.
  • Example:
1
2
3
$dg = new C_DataGrid("SELECT orderId, orderDate, customerId FROM Orders", "orderNumber", "Orders");
$subdg = new C_DataGrid("SELECT lineId,orderId,productCode,price FROM OrderDetails", "lineId", "OrderDetails");
$dg -> set_subgrid($subdg, 'orderId');

Tags:

Top