Hello Mantis Forums Users!
I'd like to sort issues by 3 different fields in View Issues Page; First sort by Priority, then by Status, then by Date Submitted. Is this possible and how to do it?
Thanks a lot!
Please help,
How to sort issues by 3 fields in View Issues Page - Urgent
Moderators: Developer, Contributor
Re: How to sort issues by 3 fields in View Issues Page - Urgent
If you go to advanced filters, you can sort by two fields. However, you can't sort by more than 2 fields.
Migrate your MantisBT to the MantisHub Cloud
Re: How to sort issues by 3 fields in View Issues Page - Urg
Hi,
I've got the same problem.
I'd like to sort by three cols
Is there any way to reach this? maybe with a plugin or some dirty code added somewhere or is this limited by the database?
Thanks a lot in advance
Philipp
I've got the same problem.
I'd like to sort by three cols
Is there any way to reach this? maybe with a plugin or some dirty code added somewhere or is this limited by the database?
Thanks a lot in advance
Philipp
Re: How to sort issues by 3 fields in View Issues Page - Urg
AFAIK there is no plugin for it
You would have to change the code of functions in file core/filter_api.php
Start looking at print_filter_show_sort()
You would have to change the code of functions in file core/filter_api.php
Start looking at print_filter_show_sort()
-
- Posts: 1
- Joined: 16 Oct 2012, 02:55
Re: How to sort issues by 3 fields in View Issues Page - Urg
core/filter_api.php
Change < 2 to < 3, got 2 places to make the changes.
Look for this function print_filter_show_sort()
add this line after array[1]
and also this
After the else statement as well.
view_all_set.php
add another 2 extra variable
and also this.
I manage to change this, and I got 3 sorting options
Change < 2 to < 3, got 2 places to make the changes.
Code: Select all
$t_sort_fields = explode( ',', $t_filter[FILTER_PROPERTY_SORT_FIELD_NAME] );
$t_dir_fields = explode( ',', $t_filter[FILTER_PROPERTY_SORT_DIRECTION] );
for( $i = 0;$i < 3;$i++ ) {
add this line after array[1]
Code: Select all
if( !isset( $t_sort_fields[2] ) ) {
$t_sort_fields[2] = '';
$t_dir_fields[2] = '';
}
Code: Select all
echo ', ';
# for third sort
echo '<select name="', FILTER_PROPERTY_SORT_FIELD_NAME, '_2">';
foreach( $t_shown_fields as $key => $val ) {
echo '<option value="' . $key . '"';
check_selected( $key, $t_sort_fields[2] );
echo '>' . $val . '</option>';
}
echo '</select>';
echo '<select name="', FILTER_PROPERTY_SORT_DIRECTION, '_2">';
foreach( $t_shown_dirs as $key => $val ) {
echo '<option value="' . $key . '"';
check_selected( $key, $t_dir_fields[2] );
echo '>' . $val . '</option>';
}
echo '</select>';
Code: Select all
echo '<input type="hidden" name="', FILTER_PROPERTY_SORT_FIELD_NAME, '_2" value="last_updated" />';
echo '<input type="hidden" name="', FILTER_PROPERTY_SORT_DIRECTION, '_2" value="DESC" />';
view_all_set.php
add another 2 extra variable
Code: Select all
$f_sort_2 = gpc_get_string( FILTER_PROPERTY_SORT_FIELD_NAME . '_2', 'summary' );
$f_dir_2 = gpc_get_string( FILTER_PROPERTY_SORT_DIRECTION . '_2', 'ASC' );
Code: Select all
$f_sort = ( ( $f_sort_d != "" ) ? $f_sort_d : $f_sort_0 ) . ( ( $f_sort_1 != "" ) ? "," . $f_sort_1 : "" ) . ( ( $f_sort_2 != "" ) ? "," . $f_sort_2 : "" );
$f_dir = ( ( $f_dir_d != "" ) ? $f_dir_d : $f_dir_0 ) . ( ( $f_dir_1 != "" ) ? "," . $f_dir_1 : "" ) . ( ( $f_dir_2 != "" ) ? "," . $f_dir_2 : "" );
Re: How to sort issues by 3 fields in View Issues Page - Urg
3 years later, it's always efficient, thank you shiroamada!