nemo
(Nemoneel)
January 18, 2011, 3:23pm
1
HI,
I have problem to handle long text in activeDropDownList. Can you help me how to break with two lines if text is long?
Here is my code
echo CHtml::activeDropDownList($model,‘title’,CHtml::listData(Books::model()->findAll($criteria),‘id’,‘name’),array(‘prompt’=> ‘Please select this field’));
THanks
Nemo
DavidHHuan
(Davidhhuan)
January 18, 2011, 3:44pm
2
i think maybe you have to findAll first and then use foreach to do it…and then assign to activeDropDownList()
nemo
(Nemoneel)
January 18, 2011, 3:52pm
3
Yes, I did, but problem is couple of data are too long. My question is, can I break the line and fit my table. Right now my table is out of shape because of this problem.
THanks
Nemo
DavidHHuan
(Davidhhuan)
January 18, 2011, 3:57pm
4
how about using css to set the width of the dropdownlist?
nemo
(Nemoneel)
January 18, 2011, 4:00pm
5
If you don’t mind, can you send me the example using css in dropdownlist?
THanks
Nemo
DavidHHuan
(Davidhhuan)
January 18, 2011, 4:04pm
6
here is the html example
<select style="width:200px">
</select>
you can set it as
echo CHtml::activeDropDownList($model,'title',CHtml::listData(Books::model()->findAll($criteria),'id','name'),array('prompt'=> 'Please select this field', 'style'=>'width:200px'));