Read only fields

Sometimes we don’t want certain fields to be editable, then we can use set_col_readonly() method.

Note that you can set more than one columns to be read only using this method.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
$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.");

// enable edit
$dg ->enable_edit("INLINE", "CRUD");
 
// hide a column
$dg -> set_col_hidden("requiredDate");

// read only columns, one or more columns delimited by comma
$dg -> set_col_readonly("orderDate, customerNumber");
 
$dg -> display();

Click on row to see the fields that are set to read only.

See Live Example!

No related content found.

Tags: , ,