I had a similar problem. I need it to refresh a grid data when the app got the focus, to show updated data, every time my app (that was on a menutab) got focus.
So i created this code on the event “onFooter” of the grid:
//autorefresh of data grid, when app get focus
?>
<SCRIPT type="text/javascript">
//refresh the data inside a grid when the app get focus
$(document).bind('focus', function() {
console.log('welcome (back)');
ajax_navigate('fast_search', 'SC_all_Cmp_SCQS_qp_SCQS_'); //this code is the same that executes sc when you do a quicksearch without any parameter
}).bind('blur', function() {
console.log('bye bye');
});
</SCRIPT>
<?PHP
Another method that reloads the grid (full page) when it gets focus
$(document).bind('focus', function() {
console.log('welcome (back)');
sc_btn_php_refreshGrid(); // this is an php button
}).bind('blur', function() {
console.log('bye bye');
});
//Also, with this method, you have to create a button of type php (in this case the button was named “php_refreshGrid”)
with the code:
sc_exit(sel);