Set the edit type to CELL enables datagrid to behave like an Excel spreadsheet. It is advisable to also enable keyboard navigation with enable_kb_nav().
- * Use keyboard arrow keys to navigate the table cell like Excel.
- * Press Enter key to edit a cell. Enter again to save.
- * While editing, press Tab key to move the next adjacent cell. Any changes are automatically saved.
1 2 3 4 5 6 7 8 9 10 11 | // 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"); $dg->enable_autowidth(true)->enable_autoheight(true); $dg->set_pagesize(100); // needs to be a large number $dg->set_scroll(true); $dg->enable_kb_nav(true); $dg->enable_edit('CELL'); $dg -> display(); |