Hide Column

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.

Very 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.
 
1
2
3
4
5
6
7
8
9
10
11
12
$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();

See Live Example!

No related content found.

Tags: , ,