Yii实现复选框批量操作实例代码
框架(架构)  /  管理员 发布于 8年前   221
整理文档,搜刮出一个Yii实现复选框批量操作实例代码,稍微整理精简一下做下分享。 在视图下 在Model中的search()函数 以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。widget('zii.widgets.grid.CGridView', array( 'id'=>'user-grid', 'dataProvider'=>$model->search(),//Model里需要有个search()方法,$model是Controller中传递的Model对象// /'filter'=>$model, 'columns'=>array( array( 'selectableRows' => 2, 'class' => 'CCheckBoxColumn', 'headerHtmlOptions' => array('width'=>'18px','align'=>'center'), 'checkBoxHtmlOptions' => array('name' => 'ids[]','align'=>'center'), ),'homework_numberID','type','target','state','author_id', array('name'=>'state','type'=>'raw','value'=>'($data->state =="not_read" ?"未读":"已审核")'), // array('name'=>'passRecord','type'=>'date'), array('name'=>'submit_time','type'=>'date'), array( 'class'=>'CButtonColumn', ), ),)); ?>public function search() { // @todo Please modify the following code to remove attributes that should not be searched. $criteria=new CDbCriteria; //$criteria->with = array('author'); //添加了和 author 的渴求式加载 // $this->state = "not_passed"; $criteria->compare('state',$this->state); //这里添加了一个 compare, username 是 User 表的字段,$this->name 是我们添加的属性,true 为模糊搜索 //$criteria->compare('username',$this->name,true); return new CActiveDataProvider($this, array( 'criteria'=>$criteria, )); 您可能感兴趣的文章:
test1 在
opencode + Oh-my-openagent,我的第一个免费的ai编程智能体管家:Sisyphus中评论 test..122 在
学历:一种延缓就业设计,生活需求下的权衡之选中评论 工作几年后,报名考研了,到现在还没认真学习备考,迷茫中。作为一名北漂互联网打工人..Zita 在
Google AI Studio升级全栈 vibe coding体验,可直接构建带登录和数据库的应用中评论 111222..123 在
Clash for Windows作者删库跑路了,github已404中评论 按理说只要你在国内,所有的流量进出都在监控范围内,不管你怎么隐藏也没用,想搞你分..原梓番博客 在
在Laravel框架中使用模型Model分表最简单的方法中评论 好久好久都没看友情链接申请了,今天刚看,已经添加。..
Copyright·© 2019 侯体宗版权所有·
粤ICP备20027696号
