⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

Flexigrid - autorefresh



Robert
  • profile picture
  • Member

Posted 27 November 2013 - 09:31 AM

Is there a way to autorefresh flexigrid when users add new records ? i mean when a user added a record to show that record to all users without them having to use f5 ? or is there a way to autorefresh at a x interval ?

 

 

Thanks for the help


Amit Shah
  • profile picture
  • Member

Posted 28 November 2013 - 09:35 AM

Hi Robert,

 

Well the solution is simple enough. Create a js file .... with following content - Adjust the interval accordingly.

var interval = null;

window.onload = function() {
    interval = setInterval(callFunc, 5000);    
}

function callFunc() {
       $("#ajax_refresh_and_loading").trigger("click");
}

And use $crud->set_js to include the script file (for ex. assets/scripts/refresh.js)

 

that should do the trick.


Robert
  • profile picture
  • Member

Posted 29 November 2013 - 07:43 AM

Thanks Amit for the help +1


jospalgal
  • profile picture
  • Member

Posted 08 June 2017 - 07:36 AM

Hi! i am trying this too but it isn't working when i add something. 

I have two tabs opened on browser and when i add something in one table, the other table is not refreshing.

What am i doing wrong?

 

My controller:

 

   $jsfile = base_url('index.php/assets/bootstrap/js/refresh.js');
        $crud->set_js($jsfile);

My js file content:

var interval = null;

window.onload = function() {
interval = setInterval(callFunc, 5000); 
};

function callFunc() {
$("#ajax_refresh_and_loading").trigger("click");
}

jospalgal
  • profile picture
  • Member

Posted 08 June 2017 - 09:19 AM

Solved, thank you anyway, it was a problem with route...