How to Using pjax on gridview to automate next page at every n second

Hi everyone,

I creating a web page to show some data using grid view. I want to automatically next page in grid view every n second using pjax. Can someone help me how to do it?

nb: Sorry for my bad english

You can try this… example…

[color="#333333"]views\site\auto-refresh.php:[/color]


<?php 

$script [color=#0000FF]=[/color] [color=#009933]<<< [color=#0000FF]JS[/color]$(document).ready(function() {    setInterval(function(){ $("#refreshButton").click(); }, 3000);});[color=#0000FF]JS[/color][/color];$this[color=#0000FF]->[/color]registerJs($script); 

?>




<?php

  [color="#3333FF"]Pjax[/color][color="#0000FF"]::[/color]begin(); ?><?= [color="#3333FF"]Html[/color][color="#0000FF"]::[/color]a([color="#009933"]"Refresh"[/color], [[color="#009933"]'site/auto-refresh'[/color]], [[color="#009933"]'class'[/color] [color="#0000FF"]=>[/color] [color="#009933"]'btn btn-lg btn-primary'[/color], [color="#009933"]'id'[/color] [color="#0000FF"]=>[/color] [color="#009933"]'refreshButton'[/color]]) ?>[color="#0033CC"]<h1>[/color]Current time: <?= $time ?>[color="#0033CC"]</h1>[/color]<?php [color="#3333FF"]Pjax[/color][color="#0000FF"]::[/color]end(); 

?>

[color="#333333"]controllers\SiteController.php:[/color]


public function [color="#FF8000"]actionAutoRefresh[/color](){[color="#0000FF"]    return[/color] $this[color="#0000FF"]->[/color]render([color="#009933"]'auto-refresh'[/color], [[color="#009933"]'time'[/color] [color="#0000FF"]=>[/color] [color="#3333FF"]date[/color]([color="#009933"]'H:i:s'[/color])]);}

Reference: http://blog.neattuto…te/auto-refresh

Thanks for replying, maybe i gave unclear explanation on my problem. The problem is that i have a grid view with, for example 10 record and i set pagination for 7 record, so link pager will appear and show 2 pages link and button first, previous, next and last. What i need is, every 1 minute grid view automatically load data page 2 on grid and 1 minute later roll back to load page 1 and so on.