davidegironi / advanceddatagridview

A .NET WinForms DataGridView with advanced capabilities
392 stars 123 forks source link

sort int and string #83

Closed Vincenzoferrara closed 2 years ago

Vincenzoferrara commented 2 years ago

hi, I have a column called (articles), it can be both numbers and text.

when I do sorting from a to z the numbers are filtered like this "1, 100, 1000, 2, 200, 2000, 3, 300, 3000, etc. is it possible to order them correctly?

in the mysql database i set the column as string

davidegironi commented 2 years ago

Hello, that's because they are ordered like strings. The only way is to grab the code of ADGV and add a custom type and a custom way of ordering, but that will be pretty annoing. Another way could be padleft zero on numbers (1 is 00001, 2 is 00002..., 1000 is 01000... and so on), that way they will be ordered.