欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  php教程

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

程序员文章站 2022-05-03 15:29:40
...
视图文件

[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.