0
我試圖輸出了CHtml ::單選按鈕列表(警予1.1.14),每個渲染元素看起來像如下:Yii的單選按鈕列表用的ListData和HTML數據屬性
<input id="option_0" type="radio" name="MyForm[customOption_id]" value="1" data-ref="a string contained in table, column ref">
<label for="option_0">Some option</label>
它是數據-ref屬性這讓我很頭疼。
代碼
<li>
<?php
echo $form->radioButtonList(
$model,'refinement_id',
CHtml::listData($refinements, 'id', 'label'),
array('separator'=>'</li><li>', 'container' => ''));
?>
</li>
我要輸出爲每個我然後可以在一些JavaScript使用數據-ref屬性。
據我可以告訴我不能將此添加到radioButtonList的htmlOptions數組,因爲我只能在這裏提供一個靜態值。
任何指針在這裏或有人告訴我我吠錯了樹會非常感激。
取決於'$ refinements'中的實例。好的謝謝。只需要知道是否可以使用Yii小部件。 – Tomeh