如何在yii gridview中添加select2扩展列 [英] how to add select2 extension column in yii gridview

查看:121
本文介绍了如何在yii gridview中添加select2扩展列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在GridView的一列中添加select2扩展名.我怎样才能做到这一点? 另外,我只想使用select2 Yii扩展名,而不要使用其纯库.

I want to add select2 extension in one column of GridView. how can I do this? In addition I just want to use select2 Yii extension and not use its pure library.

推荐答案

使用以下方式为Gridview列显示select2,希望对您有所帮助.

Use the following way to show the select2 for your Gridview column, hope it helps.

array(            
      'name'=>'category_id',
      'type'=>'html',
      'value'=>'select2::activeDropDown($model,"my_select",CHtml::listData($dataToShowFromModel,"field_name_for_value","field_name_for_text"),array("empty"=>"","placeholder"=>"Please Select",select2Options=>array("allowClear"=>true)))'
)

这篇关于如何在yii gridview中添加select2扩展列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆