Get KoolPHP UI with 30% OFF!

auto refresh the koolgrid

steve
how can i refresh the koolgrid automatically? does the refresh button on the grid window refresh only the grid or the whole page? does the refresh reload the complete table or just the changes? can i do this automatically?
Posted May 30, 2017 Kool
steve
$grid->KeepGridRefresh = true; tried this ...nothing happens???
Posted May 30, 2017 Kool
steve
what does this do :$grid->KeepGridRefresh = true; does it keep the grid updated without using the refresh button? what do i need to do to make it work?
Posted May 31, 2017 Kool
David
Hi Steve,
What do you mean "refresh automatically"? Is it by time interval or some mechanism? Thanks!
Posted Jun 1, 2017 Kool
steve
I'm trying to keep the grid updated with the latest data without having to press the refresh button. is that what :$grid->KeepGridRefresh = true; does? if so I cant get it to work. How can I refresh the grid only. I know i can refresh the page but i would like to only refresh the grid only. additionally if it is possible to refresh the grid only will the grid only update the new data or will it re-load all the grid data?
Posted Jun 1, 2017 Kool
David
You could use a script like this to automatically update a grid's data every 5 minutes:
<?php
...
$grid = new KoolGrid("myGrid");
...
?>
    <script type="text/javascript">
       setInterval(function(){
           myGrid.refresh();
           myGrid.commit();
       }, 300000);
    </script>

If you set $grid->AjaxEnabled = true; then only the grid's area will be updated. But note that if you happen to edit or insert a record in a grid when it automatically updates, you might lose your input data at that point.
Posted Jun 1, 2017 , edited Jun 2, 2017 Kool
steve
That will work, thanks. But i still don't know what $grid->KeepGridRefresh = true; does?
Posted Jun 1, 2017 Kool
steve
do anyone know what this $grid->KeepGridRefresh = true; does?
Posted Jun 1, 2017 Kool
David
Hi Steve,
Let me explain what $grid->KeepGridRefresh = true; does. In some grid's operation like editing an existing record or inserting a new record, the current grid's data does not always need to be updated every time.
For example, when you click an Edit button in a row, the grid will change that row's state to editing state but it does not refresh the whole grid's data (rows). But if you want the grid's data refreshed in any operation including when editing or inserting, $grid->KeepGridRefresh = true; is what you need.
Please let us know if you need further information. Thanks!
Posted Jun 2, 2017 , edited Jun 2, 2017 Kool -
steve
Thanks David.
Posted Jun 2, 2017 Kool