I'm trying to provide a list view with a related field included, and to allow the user to sort by the related field. The background here is a long list of parishes in a diocese, and their mass times - there will be hundreds of records, making sorting important.
This is my current template:
The display is as expected - I have the page title, then the parish name, then the time. I can sort by page title and by time, both ascending and descending.
But if I sort on the parish, the list is sorted once - I'm not clear in what order as it's neither ascending nor descending order of parish names (possibly the order in which they were entered?). Clicking on the heading to sort in the other direction does nothing. (Screenshot attached)
Is full sorting by a related field name achievable?
This is my current template:
- Code: Select all
<cms:template title='Mass Times' clonable='1' order='20'>
<cms:editable name='masstime_parish' label='Parish' type='relation' masterpage='parish.php' has='one' orderby='page_name' order_dir='asc' order='10'/>
<cms:editable name='masstime_day_of_week' label='Day of Week' opt_values='Sunday | Monday | Tuesday | Wednesday | Thursday | Friday | Saturday' type='checkbox' order='20' />
<cms:editable name='masstime_time' label='Time' type='datetime' only_time = '1' order='25' />
<cms:editable name='masstime_start_date' label='Available from' type='datetime' format='dmy' fields_separator=',' default_time='@current' order='30' />
<cms:editable name='masstime_end_date' label='Available until' type='datetime' format='dmy' fields_separator=',' default_time='@current' order='40'/>
<cms:editable name='masstime_capacity' label='Capacity for Mass (if not parish capacity)' type='text' order='50' />
<cms:config_list_view>
<cms:field 'k_selector_checkbox' />
<cms:field 'k_page_title' />
<cms:field 'masstime_parish' header='Parish' sortable = '1' >
<cms:related_pages 'masstime_parish' >
<cms:show k_page_title />
</cms:related_pages>
</cms:field>
<cms:field 'masstime_time' header='Time' sortable = '1'>
<cms:date format='h:i a' masstime_time />
</cms:field>
<cms:field 'k_actions' />
</cms:config_list_view>
</cms:template>
The display is as expected - I have the page title, then the parish name, then the time. I can sort by page title and by time, both ascending and descending.
But if I sort on the parish, the list is sorted once - I'm not clear in what order as it's neither ascending nor descending order of parish names (possibly the order in which they were entered?). Clicking on the heading to sort in the other direction does nothing. (Screenshot attached)
Is full sorting by a related field name achievable?