phpGrid 4.2 Archives | phpGrid - PHP Datagrid Create PHP grids in minutes, not hours. Fri, 06 Dec 2024 03:57:49 +0000 en-US hourly 1 CodeProjecthttps://wordpress.org/?v=7.0.3 129966043 Nested Master Detail Datagrid * https://phpgrid.com/example/nested-master-detail-datagrid/ Mon, 21 Feb 2011 00:02:13 +0000 http://phpgrid.com/?p=1157 * 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. 123456789101112131415161718192021// Always include namespace and conf.php on TOP of the script. use phpCtrl\C_DataGrid; […]

The post Nested Master Detail Datagrid * appeared first on phpGrid - PHP Datagrid.

]]>
* 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)

The post Nested Master Detail Datagrid * appeared first on phpGrid - PHP Datagrid.

]]>
1157
Master with Multiple Detail Grids * https://phpgrid.com/example/masterdetail-master-grid-with-multiple-detail-grids/ Fri, 11 Feb 2011 01:54:06 +0000 http://phpgrid.com/?p=1139 * 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 […]

The post Master with Multiple Detail Grids * appeared first on phpGrid - PHP Datagrid.

]]>
* 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();

See Live Example!

The post Master with Multiple Detail Grids * appeared first on phpGrid - PHP Datagrid.

]]>
1139
Column Grouping with Summary * https://phpgrid.com/example/column-grouping-with-summary/ Thu, 10 Feb 2011 02:11:02 +0000 http://phpgrid.com/?p=1124 * Please note this feature is only available in paid versions.     phpGrid can group data by columns. Simply define a column name on which grouping occur using method set_group_properties(). In addition to define grouping column, set summary field using method set_group_summary() by passing the column name and summary type, which can be sum, […]

The post Column Grouping with Summary * appeared first on phpGrid - PHP Datagrid.

]]>
* Please note this feature is only available in paid versions.

 

Group Summary

 

phpGrid can group data by columns. Simply define a column name on which grouping occur using method set_group_properties().

In addition to define grouping column, set summary field using method set_group_summary() by passing the column name and summary type, which can be sum, count, avg, min, or max.

 

1
2
3
4
5
6
7
8
9
10
use phpCtrl\C_DataGrid;
require_once("/file/path/to/conf.php");  

$dg = new C_DataGrid("SELECT * FROM payments", "customerNumber", "payments");

$dg->set_group_properties('customerNumber');
$dg->set_group_summary('amount','sum');
$dg->set_group_summary('checkNumber','count');

$dg -> display();

 

See Live Example!

The post Column Grouping with Summary * appeared first on phpGrid - PHP Datagrid.

]]>
1124
enable_rownumbers() https://phpgrid.com/documentation/enable_rownumbers/ Sun, 06 Feb 2011 03:20:27 +0000 http://phpgrid.com/?p=1098 Parameters: $has_rownumbers: boolean value indicating whether row number is displayed. Description: Display row number before each row. Example: 1$dg -> enable_rownumbers(true);

The post enable_rownumbers() appeared first on phpGrid - PHP Datagrid.

]]>
  • Parameters:
    • $has_rownumbers: boolean value indicating whether row number is displayed.
  • Description:
    • Display row number before each row.
  • Example:
  • 1
    $dg -> enable_rownumbers(true);

    The post enable_rownumbers() appeared first on phpGrid - PHP Datagrid.

    ]]>
    1098
    set_group_summary() * https://phpgrid.com/documentation/set_group_summary/ Sun, 06 Feb 2011 03:18:32 +0000 http://phpgrid.com/?p=1096 * Please note this feature is only available in paid versions. Parameters: $column_name: column name for grouping $summaryType: summary type. It can be one of the types below sum count avg min max Description: Display group summary of a specific summary type, such as sum or max, in the group summary footer. Remark: This method must […]

    The post set_group_summary() * appeared first on phpGrid - PHP Datagrid.

    ]]>
    * Please note this feature is only available in paid versions.

    • Parameters:
      • $column_name: column name for grouping
      • $summaryType: summary type. It can be one of the types below
        • sum
        • count
        • avg
        • min
        • max
    • Description:
      • Display group summary of a specific summary type, such as sum or max, in the group summary footer.
    • Remark:
    • Example:
    1
    2
    3
    $dg -> set_group_properties('customerNumber');
    $dg -> set_group_summary('amount','sum');
    $dg -> set_group_summary('checkNumber','count');

    The post set_group_summary() * appeared first on phpGrid - PHP Datagrid.

    ]]>
    1096
    set_group_properties() * https://phpgrid.com/documentation/set_group_properties/ Sun, 06 Feb 2011 03:13:48 +0000 http://phpgrid.com/?p=1092 * Please note this feature is only available in paid versions. Parameters: $column_name: column name for grouping $groupCollapsed: boolean value indicating whether to expand or collapse grouping when displayed. The default is false. $showSummaryOnHide: boolean value to whether display group summary when grouping is collapsed. The default is true. $groupColumnShow: boolean value to display group […]

    The post set_group_properties() * appeared first on phpGrid - PHP Datagrid.

    ]]>
    * Please note this feature is only available in paid versions.

    • Parameters:

      • $column_name: column name for grouping
      • $groupCollapsed: boolean value indicating whether to expand or collapse grouping when displayed. The default is false.
      • $showSummaryOnHide: boolean value to whether display group summary when grouping is collapsed. The default is true.
      • $groupColumnShow: boolean value to display group column. Default is false.
      • $hideGroup: boolean. Hide grouped rows. Default is false. (v7.1+)
    • Description:

      • Group grid values simply by specifying a column name.
    • Remark:

    • Example:
    1
       $dg -> set_group_properties('customerNumber');

    The post set_group_properties() * appeared first on phpGrid - PHP Datagrid.

    ]]>
    1092
    set_col_width() https://phpgrid.com/documentation/set_col_width/ Sun, 06 Feb 2011 03:07:00 +0000 http://phpgrid.com/?p=1089 Parameters: $col_name: column name $width: width Description: Specify column width in pixel. The width should be an integer value. Example: 1$dg -> set_col_width("comments", 500);

    The post set_col_width() appeared first on phpGrid - PHP Datagrid.

    ]]>
    Starting version 6.6, phpGrid will automatically resize column width based on its content during page load. Users can also double-click a column divider to resize a column.
    X
    • Parameters:

      • $col_name: column name
      • $width: width
    • Description:

      • Specify column width in pixel. The width should be an integer value.
    • Example:
    1
    $dg -> set_col_width("comments", 500);

    The post set_col_width() appeared first on phpGrid - PHP Datagrid.

    ]]>
    1089
    set_query_filter($WHERE) https://phpgrid.com/documentation/set_query_filterwhere/ Tue, 14 Sep 2010 07:48:22 +0000 http://phpgrid.com/?p=1078 Parameters: $WHERE: Sql WHERE statement to select data conditionally (DO NOT include WHERE keyword). Description: The query filter is essentially the WHERE clause without the WHERE. The method adds WHERE condition an existing Sql SELECT statement. Use this method if you have WHERE clause in your SQL statement. You should use the same SQL syntax, such as single […]

    The post set_query_filter($WHERE) appeared first on phpGrid - PHP Datagrid.

    ]]>
  • Parameters:
    • $WHERE: Sql WHERE statement to select data conditionally (DO NOT include WHERE keyword).
  • Description:
    • The query filter is essentially the WHERE clause without the WHERE. The method adds WHERE condition an existing Sql SELECT statement. Use this method if you have WHERE clause in your SQL statement. You should use the same SQL syntax, such as single quotes around non-numeric values, and even SQL functions.
  • Remark:
    • NEVER include keyword “WHERE” the filter. phpGrid automatically adds WHERE to the query.
    • Use only SINGLE QUOTE around the filtered value.
    • When using table alias, also include the new table alias
  • Example:
  • 1
    $dg -> set_query_filter("status='Shipped' AND YEAR(shippedDate) = 2003");

     

    Using Table Alias

    When using table alias, please also include the table alias as part of the filter. Otherwise, the full table name is automatically inserted as part of the query which would throw “Unknown column in ‘where clause” error.

    Example

    1
    $dg -> set_query_filter("T.mycolumn = 'foo' ");

    The post set_query_filter($WHERE) appeared first on phpGrid - PHP Datagrid.

    ]]>
    1078