Yii-视图- CListView操作扩展用法(zyd)_PHP教程
程序员文章站
2022-05-20 07:53:49
...
视图文件
[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.
声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。
相关文章
相关视频