Inline edit mode also comes with actions column with edit and delete buttons. Use add_column method to add “actions”. In formatoptions, specify the following property to display or hide edit and delete buttons:
- · delbutton – true or false
- · editbutton – true or false
Note that when use actions column, it is not necessary to specify edit options in enable_edit method. An advantage using actions column is that it’s possible to have row-level permission. Please see datagrid row-level edit permission example.
$dg = new C_DataGrid("SELECT * FROM orders", "orderNumber", "orders");
// enable edit - but no need to specify 2nd parameter because we will be using actions column
$dg -> enable_edit("INLINE");
$dg->add_column("actions", array('name'=>'actions',
'index'=>'actions',
'width'=>'70',
'formatter'=>'actions',
'formatoptions'=>array('keys'=>true, 'editbutton'=>true, 'delbutton'=>false)),'Actions');
$dg -> display();