I am managing a project that is built using SkyGear CMS. As per the Documentation I have the flexibility to change the cms-config.yaml only. Now I need to sort a field with type: EmbeddedReference as shown in the code below.
show:
label: Offers
fields:
- name: packages
type: EmbeddedReference
default_sort:
name: night_count
ascending: false
label: Packages
reference_via_back_reference: package
reference_from_field: offer_id
reference_fields:
- name: night_count
type: Integer
- type: _created_at
- type: _updated_at
reference_delete_action: delete-record
I tried using the default_sort(as per the give documentation of SkyGear) but it has no effect if tried with any field. Any help will be highly appreciated.
default_sort
is an attribute for record list. In your case, reference_position_field
and reference_position_ascending
should be the attributes you are looking for.
BTW, EmbeddedReference
is not a valid field type in the latest version but embedded_reference_list
.
The configuration would look like this:
show:
label: Offers
fields:
- name: packages
type: embedded_reference_list
label: Packages
reference_via_back_reference: package
reference_from_field: offer_id
reference_position_field: night_count
reference_position_ascending: false
reference_fields:
- name: night_count
type: Integer
- type: _created_at
- type: _updated_at
reference_delete_action: delete-record