search
Homephp教程php手册Yii-视图- CListView操作扩展用法(zyd)

Yii-视图- CListView操作扩展用法(zyd)

Jun 13, 2016 am 10:55 AM
adddrophtmlphpzydExpandoperatedocumentusageview

视图文件

[html]  

$add_drop = CHtml::dropDownList('catlist','',CmpCat::model()->getCmpCat('移动到分类'),array('class'=>'s_ipt w_120 removedropcatbatch'));  

$remove_drop = CHtml::dropDownList('catlist','',CmpCat::model()->getCmpCat('添加到分类'),array('class'=>'s_ipt w_120 adddropcatbatch'))  

?>  

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

    'dataProvider'=>$model->search(),  

    'itemView'=>'product_saleing_view',    

    'emptyText'=>'暂时没有数据',  

    'selectAll'=>array('ids[]','id[]'),  

    'artLink'=>array(  

        //首页推荐  

        array(Yii::t('cmp','Recommended home'),'/company/product/recommend','确认推荐选中产品到首页!'),  

        //取消推荐  

        array(Yii::t('cmp','un Recommended home'),'/company/product/uncommend','确认取消推荐选中产品!'),  

        //下架  

        array(Yii::t('cmp','downshelf'),'/company/product/downshelf','确认上架选中产品!'),  

    ),  

    'batchItem'=>array(  

        //移动到分类  

        $add_drop,  

        //添加到分类  

        $remove_drop,  

    ),  

    ));  

?>  

 

jq代码

[html]  

//添加到分类  

$('.adddropcatbatch').bind('change',function(){  

    var pid = $(".chkitem:checked").serialize() ;  

    var catid = $(this).val();  

    location.href='/company/cmpcat/addcmpcat?catid='+catid+'&'+pid;  

})  

  

//移动到分类  

$('.removedropcatbatch').bind('change',function(){  

    var pid = $(".chkitem:checked").serialize() ;  

    var catid = $(this).val();  

    location.href='/company/cmpcat/removecmpcat?catid='+catid+'&'+pid;  

})  

 

 

全选反选

[html]  

'chk f_l chkitem','onclick'=>'CheckList("ids[]","id[]")','value'=>$data->zp_id))?>  

 

效果图

1.

 

2.

Statement
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool