0

In order to find all records with a given quantity I have the following code. This is giving me the proper records back but it only shows the 'id' of each record. How can I display 'AttributeB' instead of 'id' in my results.

$qty = $model->relation->Quantity;
$item = ModelB::model()->findAllByAttributes(array('Quantity'=>$qty));

echo $form->dropDownList($model, 'Attribute', $item);
4

1 回答 1

2

try this

echo $form->dropDownList($model,'Attribute',CHtml::listData($item, 'id', 'attributeB')); 
于 2013-02-06T22:50:31.113 回答