将CSS类添加到Yii活动checkBoxList的特定项目 [英] Adding a css class to specific items of Yii active checkBoxList

查看:77
本文介绍了将CSS类添加到Yii活动checkBoxList的特定项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Yii和活动的复选框列表。
我知道参数。我需要向项目添加一个标记CSS类。
这是我的代码:

Working with Yii and active checkboxlist. I know the params. I need to add a flag css class to the items. This is my code:

$form->checkBoxList($model, 'items', $selected, array(
    'class'=>'default_class'
));

此代码仅向每个项目添加一个default_class。但是我需要针对特定​​项目使用不同的类。

This code just adds a default_class to every item. But I need a different class for specific items.

推荐答案

@XIII,我已经更新了答案

@XIII, I had updated my answer

$form->checkBoxList($model, 'items', $selected, array(
  'options' => array(
       'value1'=>array('disabled'=>true, 'label'=>'value 1'),
       'value2'=>array('label'=>'value 2', 'class' => 'css-class-defined'),
   ),
));

请阅读有关所使用函数的文档,或查看源代码 system。 web.helpers.CHtml 第764行

Please read docs about function what you used, or see source code system.web.helpers.CHtml line 764

这篇关于将CSS类添加到Yii活动checkBoxList的特定项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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