Yii Framework Development Tutorial Zii Component-Selectable Example_PHP Tutorial

WBOY
Release: 2016-07-14 10:07:54
Original
1305 people have browsed it

CJuiSelectable can display a list. Each item in the list supports the Select event. It encapsulates the JUI Selectable plug-in. Its basic usage is as follows:

[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));
});
}'
)
));
?>
Use Javascripts to respond to selection events.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/477820.htmlTechArticleCJuiSelectable can display a list. Each item in the list supports the Select event. It encapsulates the JUI Selectable plug-in, which is basically The usage is as follows: [php] ?php Yii::app()-clientScript-regis...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!