Hi,
When passing in the $data array to display a dropdownList like so:
$data = array('item1', 'item2', 'item3');
echo $form->dropDownList($model, 'id', $data, array('prompt' => t("- Select an option -")));
I want to be able to set htmlOptions for each individual select item, something like this:
$data = array(
'item1' => array('htmlOptions' => array('class' => 'red-background')),
'item2' => array('htmlOptions' => array('class' => 'blue-background')),
);
echo $form->dropDownList($model, 'id', $data, array('prompt' => t("- Select an option -")));
But instead it creates <optgroup> tags.
Is there a way currently to do what I’m doing without extending classes?