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

来源:互联网 发布:java设计模式 组合模式 编辑:程序博客网 时间:2024/05/17 23:14


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

其基本用法如下:

[php] view plaincopyprint?
  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. ?>  

201212129015本例下载

 

0 0
原创粉丝点击