loryck
(Loryck)
April 24, 2009, 1:13pm
1
Hello !
I comme back with my problem of refresh.
I display the result of a request Sql in a <div> + <table>.
The sql table moves regularly.
I would like update the div automatically every second and the rest of the page (input …) must be used simultaneously
How can I do that?
drech
(Agitated)
April 24, 2009, 4:36pm
2
I suppose you could use something like JHeartbeat and have it call an action that regenerates the table:
http://www.jasons-to…com/JHeartbeat/
Edit:
Also check out jQuery Timers:
http://jquery.offput.ca/every/
I can't seem to get to the jquery plugin repo atm, but Timers is a little more robust.
loryck
(Loryck)
May 5, 2009, 2:19pm
3
Hi,
After several tests, I use 'jQuery.refreshDiv.js'
http://forum.alsacre…diquement-.html
Sorry it's in French, but it's better for me
I use it like this:
in the first view myview/appel
<?php
Yii::app()->clientScript->registerScriptFile("/pathjs/jquery.refreshdiv.js");
Yii::app()->clientScript->registerScript(
'ajaxFormLoad',
'$("#appel-list").refreshDiv("index.php?r=myview/appels&id=pk_appels'", 2*1000) ;',
CClientScript::POS_READY
);
?>
<div id="appel-list">
<?php $this->renderPartial('appels',array('form'=>$form, 'appelList'=>$appelList)); ?>
</div>
...
in the second view myview/appels, for each refresh
<table>
<?php
// my list
?>
</table>
in the CController
<?php
public function actionAppels()
{
$this->renderPartial('appels',array('appelList'=>$this->loadAppelList()));
}
public function actionAppel()
{
....
$this->render('appel',array('form'=>$form, 'appelList'=>$this->loadAppelList()));
}
?>
It's running good