hide column Archives | phpGrid - PHP Datagrid Create PHP grids in minutes, not hours. Tue, 03 Dec 2024 18:24:23 +0000 en-US hourly 1 CodeProjecthttps://wordpress.org/?v=7.0.3 129966043 Hide Column https://phpgrid.com/example/hide-column/ Thu, 16 Sep 2010 00:13:39 +0000 http://64.38.236.7/?p=498 For columns need not to be shown, such as primary key, use method set_col_hidden() to hide those columns. To hide column in both datagrid and form, set the second parameter to false. This is useful to hide the auto increment primary key field from edit form.   12345678910111213141516// Always include namespace and conf.php on TOP […]

The post Hide Column appeared first on phpGrid - PHP Datagrid.

]]>
For columns need not to be shown, such as primary key, use method set_col_hidden() to hide those columns. To hide column in both datagrid and form, set the second parameter to false. This is useful to hide the auto increment primary key field from edit form.

Important: The data are still sent to web browser but hidden using CSS display:none. For sensitive data such as passwords and SSN etc, do not use this method, instead do not include those fields in your SQL at all.
X
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// Always include namespace and conf.php on TOP of the script.
use phpCtrl\C_DataGrid;
require_once("/file/path/to/conf.php");  

$dg = new C_DataGrid("SELECT * FROM orders", "orderNumber", "orders");

// change column titles
$dg -> set_col_title("orderNumber", "Order No.");
$dg -> set_col_title("orderDate", "Order Date");
$dg -> set_col_title("shippedDate", "Shipped Date");
$dg -> set_col_title("customerNumber", "Customer No.");
 
// hide a column
$dg -> set_col_hidden("requiredDate");
 
$dg -> display();

To display in the grid but hide when edit, you can use the following:

1
$dg->set_col_property('COLUMN_NAME', array('editable'=>false,'hidedlg'=>true));

See Live Example!

The post Hide Column appeared first on phpGrid - PHP Datagrid.

]]>
498