CDropDownList : move an item to the end


I’m using a CDropDownList in a form.

This DropDownList takes as value results from CHtml::listdata(xxx, ‘id’,‘name’)

I wonder if there is an option which could say that a row of the listdata results could be at the end of the dropDowlist ?

listdata return array([2]=>‘name1’,[5]=>‘name2’, …) and the results appear like that in the dropdwonlist.

Meanwhile I would like that a particular value of this array appear at the end of the dropdownlist

For example when you give a dropdownlist of choices and you would like to specifiy at the end of your dropdownlist "other choices …"


You have to sort the items manually.

I did similar to display items at the top of at a dropdownList.

See the attribute ‘topKeys’ in the code of the extension countrycodes

Thanks Joblo

I did it also manually