Disable sort on items shown in Editor Select Field
Disable sort on items shown in Editor Select Field
I'm retrieving a list of states and provinces from a table, and showing them as options in an Editor Select-type field.
I'd like to show the list of states, then the list of provinces in the order I have added them to the table.
Is there an option to disable sorting when fetching the data to populate the Select field?
Here is the pertinent part of my code:
Field::inst('Address.state')
->options(Options::inst()
->table('State')
->value('value')
->label('label')
)
This question has accepted answers - jump to:
Answers
Found ->order('') method on Select field (https://editor.datatables.net/manual/php/joins#Options-class)
Added integer field to each table with states and provinces, and added
->order('_id ASC')
to maintain desired order.Perfect - thanks for posting back!
Allan