Skip to content
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

Catch the click in headers? #45

Open
cgarcia55 opened this issue Nov 2, 2019 · 4 comments
Open

Catch the click in headers? #45

cgarcia55 opened this issue Nov 2, 2019 · 4 comments

Comments

@cgarcia55
Copy link

it is possible to intercept the didTapColumn function, in order to manipulate the sortof the information, since I have a problem in which I cannot format the numbers (example: $ 1,234,344.44) since they are converted to string and when accommodating them it does not correctly.

@pavankataria
Copy link
Owner

I'm not sure I understand. What is the connection between the didTapColumn and formatting numbers? You should be able to format the numbers as you please and then insert that into the Data object as a string.

For example

numberFormatter.style = .currency
numberFormatter.locale = "en_GB"
let number = NSDecimalNumber(decimal: 1234344.44)
numberFormatter.string(from: number)

@cgarcia55
Copy link
Author

cgarcia55 commented Nov 4, 2019

An apology if I did not explain myself well, I have already formatted the data, the detail is that if I press the header of any of the columns, the sort that gives me is incorrect because the value of the data is not double, rather its a string ( or so I think that is the reason), since it does not give me a completely correct ascending arrangement neither descending one .
I attach an image.

table

That is why I tried to catch the click on the header (assuming it was the didtapColumn) and this be able to do the sort by myself.

I hope I explained myself well.
Thanks in advance and greetings.

@pavankataria
Copy link
Owner

Okay, that's a problem. Thank you for writing such a detailed and helpful response.
What we need is a custom sort allowing you to define the sort order for specific columns.

I will want to work on this as soon as possible. Can you tell me how you would want to define the sorting behavior yourself?

@cgarcia55
Copy link
Author

I had the idea of managing a kind of absolute value by converting the currency value to double, in order to make a normal ascending arrangement.
That was why my question, if it was possible to intercept the click in the header. to sort from the arrangement that fills the table.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants