-
Notifications
You must be signed in to change notification settings - Fork 240
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Apply sorting on date column: #189
Comments
Hi @sanakalam, can you pleas show your comparator for the date column? Best regards, |
tableView.setColumnComparator(6, new Comparator() { |
What data type does |
yeah String. I am fetching data from API and date return as a String |
I would suggest to transform the string to date using |
SimpleTableDataColumnAdapter c7 = new SimpleTableDataColumnAdapter<>((SimpleTableDataColumnAdapter.StringValueExtractor) data -> data.getCreatedOn().toString()); For Date which method we have to use instead of StringValueExtractor because it only accepts String value. |
Hi you can use SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd"); // TODO: adapt pattern
SimpleTableDataColumnAdapter c7 = new SimpleTableDataColumnAdapter<>(
(SimpleTableDataColumnAdapter.StringValueExtractor) data -> dateFormatter.format(data.getCreatedOn())); |
@ISchwarz23 Thanks For your Support. |
I want to apply sorting on date column but there is an issue date is also considered as a string and 1st date of all months shown then 2nd date of all month showing.
![image](https://user-images.githubusercontent.com/54615542/77147055-41dbd080-6aae-11ea-89be-a106a8db6260.png)
How can we manage sorting for date column
The text was updated successfully, but these errors were encountered: