Volt select with Order By ?

I have following syntax on the volt template.

I need to know how do i ORDER the select box values using the Table column called "country_sort" ASC ?

                                               {{ select(
                                                'country',
                                                countries ,
                                                'using': ['country_id','country_title'],
                                                'onchange': 'showState()',
                                                'class' : 'required',
                                                'useEmpty': 'true',
                                                'emptyText' : 'Please Choose',
                                                'emptyValue' : ''
                                                ) }}

i cant find a way to do this via Volt. I have seen other solutons like selecting them in the contorllers or usin echo Phalcon\Tag\Select::..etc but thats not what i want.



8.1k
edited Feb '16

In your controller:

countries = A::find(['order' => 'country_sort'])


4.3k
edited Feb '16

thanks