1st question: If I have a column that is a date or a year and I have that sorting by default, but then someone chooses to sort by another column and the dates are all in seemingly random order, is there a way to keep the dates in order as a secondary type of sorting when possible? I believe you can hold shift and select a second column, but is there a way to do this by default since I do not have my date or year column showing?
2nd question: If I have a column of years just inserted as a string, is there a way to order the filter menu in descending order? Our most recent years are the most important, so we would like to have them at the top.
1. I'm sorry to disappoint you, but unfortunately something like this is not yet possible with the plugin's built-in features. Another one of our customers designed a workaround, though. Please take a look at this ticket:
He explained everything, and you should be able to use his workaround in your case.
2. Unfortunately, no. If the column is saved as a string, the sorting will be performed in alphabetical order, meaning 01/02/2001 will come before 11/01/2001 (D/M/YYYY format).
The customer's solution was helpful, but only seemed to help with filtering, not sorting by other columns.. However, thank you for pointing me to that ticket. As for the order of the filter menu, is there another data type that would allow me to choose descending. In this instance, I'm only inputting the year: 2020, 2019, 2018, etc. I tried "integer" and that didn't change the options.
Well, integer should work fine. However, if the column is saved as "VARCHAR" or "TEXT" in the database, it may be the reason why the sorting doesn't apply as it should.
You would need to access this table in the database, and change the type there. If you're not sure how to do that, I can help, but I'll need you to provide me a temporary WP-admin login for your site where this happens and database access (PHPMyAdmin or cPanel), so we could log in and take a look ‘from the inside’ as that’s the most efficient way to see and resolve the issue. We do not interfere with any data or anything else except for the plugin (in case that’s a production version of the site), and of course we do not provide login data to third party. You can write credentials here just check Private Reply so nobody can see them except us.
Thank you, Aleksandar. It is difficult for us to provide a temporary access login given our setup, but I do have someone here I can ask to update the database tables with the instruction you provided. Thanks again.
We checked the data type in the database and those two were not in there. It doesn't seem to matter if it is stored as a string or an integer as there does not seem to be a way to order the drop-down menu when we have it auto-populating from the data in that column. Can you provide instructions for us to customize the order of the menu to descending? It sure would be nice if this was a feature in the interface to choose ascending or descending for the menu items.
jQuery(document).ready(function( $ ) { $('#table_1').on( 'init.dt', function () { var list = $(".column-year").find("ul.dropdown-menu"); var listItems = list.find("li"); list.append(listItems.get().reverse()); }); });
If you have the data of that column populate in defined values list:
That column has to be a string column - this setting doesn't appear for any other column type.
To have the list appear in ascending or descending order in that list, unfortunately you need to do it manually, so your JS solution is the best one yet. I'm glad to hear you were able to resolve the issue you're having with this.
We're working on including the order of drop-down filter in plugin's UI, but I can't provide any ETA.
1st question: If I have a column that is a date or a year and I have that sorting by default, but then someone chooses to sort by another column and the dates are all in seemingly random order, is there a way to keep the dates in order as a secondary type of sorting when possible? I believe you can hold shift and select a second column, but is there a way to do this by default since I do not have my date or year column showing?
2nd question: If I have a column of years just inserted as a string, is there a way to order the filter menu in descending order? Our most recent years are the most important, so we would like to have them at the top.
Hello Lori
Thank you for your purchase.
1. I'm sorry to disappoint you, but unfortunately something like this is not yet possible with the plugin's built-in features. Another one of our customers designed a workaround, though. Please take a look at this ticket:
https://tmsplugins.ticksy.com/ticket/2070817/
He explained everything, and you should be able to use his workaround in your case.
2. Unfortunately, no. If the column is saved as a string, the sorting will be performed in alphabetical order, meaning 01/02/2001 will come before 11/01/2001 (D/M/YYYY format).
Kind Regards,
Aleksandar Vuković
[email protected]
Rate my support
wpDataTables: FAQ | Facebook | Twitter | Instagram | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Instagram | Amelia demo sites | Docs | Discord Community
You can try wpDataTables add-ons before purchasing on these sandbox sites:
Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables
The customer's solution was helpful, but only seemed to help with filtering, not sorting by other columns.. However, thank you for pointing me to that ticket. As for the order of the filter menu, is there another data type that would allow me to choose descending. In this instance, I'm only inputting the year: 2020, 2019, 2018, etc. I tried "integer" and that didn't change the options.
Hi again Lori
Well, integer should work fine. However, if the column is saved as "VARCHAR" or "TEXT" in the database, it may be the reason why the sorting doesn't apply as it should.
You would need to access this table in the database, and change the type there. If you're not sure how to do that, I can help, but I'll need you to provide me a temporary WP-admin login for your site where this happens and database access (PHPMyAdmin or cPanel), so we could log in and take a look ‘from the inside’ as that’s the most efficient way to see and resolve the issue. We do not interfere with any data or anything else except for the plugin (in case that’s a production version of the site), and of course we do not provide login data to third party. You can write credentials here just check Private Reply so nobody can see them except us.
Kind Regards,
Aleksandar Vuković
[email protected]
Rate my support
wpDataTables: FAQ | Facebook | Twitter | Instagram | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Instagram | Amelia demo sites | Docs | Discord Community
You can try wpDataTables add-ons before purchasing on these sandbox sites:
Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables
Thank you, Aleksandar. It is difficult for us to provide a temporary access login given our setup, but I do have someone here I can ask to update the database tables with the instruction you provided. Thanks again.
You're welcome Lori
If you have any further questions or issues, please let me know.
Kind Regards,
Aleksandar Vuković
[email protected]
Rate my support
wpDataTables: FAQ | Facebook | Twitter | Instagram | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Instagram | Amelia demo sites | Docs | Discord Community
You can try wpDataTables add-ons before purchasing on these sandbox sites:
Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables
We checked the data type in the database and those two were not in there. It doesn't seem to matter if it is stored as a string or an integer as there does not seem to be a way to order the drop-down menu when we have it auto-populating from the data in that column. Can you provide instructions for us to customize the order of the menu to descending? It sure would be nice if this was a feature in the interface to choose ascending or descending for the menu items.
We came up with the following solution:
jQuery(document).ready(function( $ ) {
$('#table_1').on( 'init.dt', function () {
var list = $(".column-year").find("ul.dropdown-menu");
var listItems = list.find("li");
list.append(listItems.get().reverse());
});
});
Hello Lori
If you have the data of that column populate in defined values list:
That column has to be a string column - this setting doesn't appear for any other column type.
To have the list appear in ascending or descending order in that list, unfortunately you need to do it manually, so your JS solution is the best one yet. I'm glad to hear you were able to resolve the issue you're having with this.
We're working on including the order of drop-down filter in plugin's UI, but I can't provide any ETA.
Kind Regards,
Aleksandar Vuković
[email protected]
Rate my support
wpDataTables: FAQ | Facebook | Twitter | Instagram | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Instagram | Amelia demo sites | Docs | Discord Community
You can try wpDataTables add-ons before purchasing on these sandbox sites:
Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables