搜索
首页php教程php手册Yii Framework 开发教程Zii组件-Selectable示例

CJuiSelectable可以显示一个列表,列表的每个项支持Select事件,它封装了 JUI Selectable插件,其基本用法如下:

 

 

[php]  

Yii::app()->clientScript->registerCss('selectable',"  

#selectable {list-style-type: none; margin: 0; padding: 0; width: 60%;}  

#selectable li {margin: 2px; padding: 4px; border: 1px solid #e3e3e3; background: #f7f7f7}  

#selectable .ui-selecting { border: 1px solid #fad42e; }  

#selectable .ui-selected { border: 1px solid #fad42e; background: #fcefa1;}  

#select-result {margin: 0 0 10px 2px; }  

", 'screen', CClientScript::POS_HEAD);  

?>  

  

 

  

none
 

  

$this->widget('zii.widgets.jui.CJuiSelectable',array(  

    'id'=>'selectable',  

    'items'=>array(  

                'id1'=>'Item 1',  

                'id2'=>'Item 2',  

                'id3'=>'Item 3'  

                ),  

            'options'=>array(  

                'stop'=>'js: function(event,ui){  

            var result = $("#select-result").emptyempty();  

            $(".ui-selected", this).each(function(){  

                var index = $("#selectable li").index(this);  

                result.append(" #" + (index + 1));  

            });  

        }'  

                )  

            ));  

?>  

 

Yii::app()->clientScript->registerCss('selectable',"

#selectable {list-style-type: none; margin: 0; padding: 0; width: 60%;}

#selectable li {margin: 2px; padding: 4px; border: 1px solid #e3e3e3; background: #f7f7f7}

#selectable .ui-selecting { border: 1px solid #fad42e; }

#selectable .ui-selected { border: 1px solid #fad42e; background: #fcefa1;}

#select-result {margin: 0 0 10px 2px; }

", 'screen', CClientScript::POS_HEAD);

?>www.2cto.com

 

 

none

 

$this->widget('zii.widgets.jui.CJuiSelectable',array(

'id'=>'selectable',

'items'=>array(

'id1'=>'Item 1',

'id2'=>'Item 2',

'id3'=>'Item 3'

),

'options'=>array(

'stop'=>'js: function(event,ui){

var result = $("#select-result").empty();

$(".ui-selected", this).each(function(){

var index = $("#selectable li").index(this);

result.append(" #" + (index + 1));

});

}'

)

));

?>

 

 

 

使用Javascipts 来响应选择事件。

 

 

 

声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn

热AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover

AI Clothes Remover

用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool

Undress AI Tool

免费脱衣服图片

Clothoff.io

Clothoff.io

AI脱衣机

Video Face Swap

Video Face Swap

使用我们完全免费的人工智能换脸工具轻松在任何视频中换脸!

热工具

WebStorm Mac版

WebStorm Mac版

好用的JavaScript开发工具

安全考试浏览器

安全考试浏览器

Safe Exam Browser是一个安全的浏览器环境,用于安全地进行在线考试。该软件将任何计算机变成一个安全的工作站。它控制对任何实用工具的访问,并防止学生使用未经授权的资源。

SublimeText3 Linux新版

SublimeText3 Linux新版

SublimeText3 Linux最新版

螳螂BT

螳螂BT

Mantis是一个易于部署的基于Web的缺陷跟踪工具,用于帮助产品缺陷跟踪。它需要PHP、MySQL和一个Web服务器。请查看我们的演示和托管服务。

SublimeText3 Mac版

SublimeText3 Mac版

神级代码编辑软件(SublimeText3)