I am a Yii newbie and want to create a view that calls another view (within a div) and automatically refreshes it on a regular basis (without user interaction). Might anyone be able to point me to or supply a simple working example?
Many thanks!
I am a Yii newbie and want to create a view that calls another view (within a div) and automatically refreshes it on a regular basis (without user interaction). Might anyone be able to point me to or supply a simple working example?
Many thanks!
If You’re looking for “jQuery/Ajax sample” here are 3 samples you can manipulate online.
I first built them for my own purpose so I could come back later on them when I forget sthing, but it seems that it could be useful…
They are simple implementations of some parts of the cookbook that I had difficulties to imagine the "how it works".
yii-cjuisortable-widget
dropdown-pagesize
cjuidialog-and-ajaxsubmitbutton
About
Sorry I haven’t done that. I advise you digging in the cookbook which is very detailed and rich.
You can now watch a simple drag and drop in action.
This is the code:
<style type="text/css">
#drag { list-style-type: none; margin: 3px 3px 20px 3px; padding: 2px; width: 30%; height: 260px;background-color:#FAF0B1;
display:inline; float: left; }
#droppable { list-style-type: none; margin: 3px 3px 20px 3px; padding: 2px; width:300; height: 212px;background-color:#6399cd;
display:inline; float: right; }
.cleared { clear:both; }
</style>
<div style="display:inline;">
<ul id="drag">
<?php
$this->beginWidget('zii.widgets.jui.CJuiDraggable', array(
'id' => 'draggable',
'options' => array(
'scope' => 'myscope',
)
));?>
<img style="float:left;" src="images/b_mount.png"/>
<?php $this->endWidget(); ?>
<?php
$this->beginWidget('zii.widgets.jui.CJuiDraggable', array(
'id' => 'draggable-nonvalid',//No cookie in the cd player for God's sake !
'options' => array(
'scope' => 'myscope',
)
));?>
<img style="float:right;" src="images/cookie.png"/>
<?php $this->endWidget(); ?>
</ul>
<?php
$this->beginWidget('zii.widgets.jui.CJuiDroppable', array(
'id'=>'droppable',
'options'=>array(
'accept'=> '#draggable',
'activeClass'=> 'ui-state-hover',
'hoverClass'=> 'ui-state-active',
'scope' => 'myscope',
'drop' => 'js:function(event, ui) {alert("dropping accepted.")}'
),
));?>
<img src="images/player.png"/>
<?php $this->endwidget(); ?>
</div>