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 | $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(); |