Yii Framework 开发教程(46) Zii组件-Sortable示例



CJuiSortable显示一个列表,列表中的列表项可以通过拖放重新调整顺序,它封装了 JUI Sortable插件。

其基本用法如下:

  1. <?php  
  2. Yii::app()->clientScript->registerCss('sortable', "  
  3. #sortable {list-style-type: none; margin: 0; padding: 0; width: 60%;}  
  4. #sortable li {margin: 2px; padding: 4px;  
  5. border: 1px solid #e3e3e3; background: #f7f7f7}  
  6. ", 'screen', CClientScript::POS_HEAD);  
  7. ?>  
  8.   
  9. <h2><?php echo Yii::t('ui','Sortable');?></h2>  
  10.   
  11. <?php $this->widget('zii.widgets.jui.CJuiSortable'array(  
  12.     'id'=>'sortable',  
  13.     'items'=>array(  
  14.         'id1'=>'Item 1',  
  15.         'id2'=>'Item 2',  
  16.         'id3'=>'Item 3',  
  17.     ),  
  18.     'options'=>array(  
  19.         'cursor'=>'n-resize',  
  20.     ),  
  21. ));  
  22. ?>  
<?php
Yii::app()->clientScript->registerCss('sortable', "
#sortable {list-style-type: none; margin: 0; padding: 0; width: 60%;}
#sortable li {margin: 2px; padding: 4px;
border: 1px solid #e3e3e3; background: #f7f7f7}
", 'screen', CClientScript::POS_HEAD);
?>

<h2><?php echo Yii::t('ui','Sortable');?></h2>

<?php $this->widget('zii.widgets.jui.CJuiSortable', array(
	'id'=>'sortable',
	'items'=>array(
		'id1'=>'Item 1',
		'id2'=>'Item 2',
		'id3'=>'Item 3',
	),
	'options'=>array(
		'cursor'=>'n-resize',
	),
));
?>

201212129015本例下载

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值