I achieved it by making use of order_by in attributes inside model_config as
follows.
changed code is as follows:

- type: Select
   name: user
   label: 'Select user: '
   model_config:
      model: Database::Users
      label_column: name
      id_column: id
      attributes:
        order_by: 'name asc'

thanks.
Best Regards,
Mohan

mohanprasad wrote:
> 
> Hello everybody,
> 
> i am not sure whether i have to ask this question in DBIx-Class/FormFu
> mailing list.
> I want to show all the items in a select box in alphabetical order.
> 
> I have written the below code for the same.
> ---
> action:
> auto_fieldset: 1
> auto_id: '%f_%n'
> elements:
> - type: Select
>    name: user
>    label: 'Select user: '
>    model_config:
>       model: Database::Users
>       label_column: name
>       id_column: id
>       order_by:
>           'name': 'ASC'
>    constraints:
>       - Required
> - type: Submit
>   value: Submit
>   name: submit
> 
> But this is not sorting the select box entries in ascending order.
> could anybody please let me know how to provide order_by clause with
> model_config?
> 
> thank you.
> 
> Best Regards,
> Mohan
> 

-- 
View this message in context: 
http://n2.nabble.com/using-order-by-with-model_config-tp2824641p2824741.html
Sent from the HTML-FormFu mailing list archive at Nabble.com.


_______________________________________________
HTML-FormFu mailing list
HTML-FormFu@lists.scsys.co.uk
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu

Reply via email to