Sometimes you need the datagrid to be able to remember sort order and current page. For that, it requires only a single function call to “enable_persist_state()” function to enable this feature. It stores current page, sort name, sort order, and even filter information in the HTML5 “localStorge” automatically. This is different from Cookie or Session because the data stored in localStorage has no expiration time.
When you need to clear what’s int the localStorage for the current datagrid, click the “refresh” icon in the footer.
Note it does not support subgrid.
1 2 3 4 5 6 7 8 | use phpCtrl\C_DataGrid; require_once("/file/path/to/conf.php"); $dg = new C_DataGrid("SELECT * FROM orders", "orderNumber", "orders"); $dg->enable_edit('INLINE'); $dg->enable_search(true); $dg->enable_persist_state(true); $dg->display(); |