Not working - order table by price

Not working - order table by price

cernochcernoch Posts: 2Questions: 0Answers: 0

Hi all,
I have problem with my DataTable when i want to sort it by price. It takes prices like strings so 90 is larger then 944. How can i manualy change column type. And how can i make it dynamically, because user can choose columns which he wants to see and also change order of columns.

Any advice?

Thanks,
Jirka

Replies

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    Hi @cernoch ,

    We're happy to take a look. As per the forum rules, if you could link to a running test case showing the issue we can offer some help. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

  • allanallan Posts: 63,464Questions: 1Answers: 10,466 Site admin

    Without a test case, as Colin points out, it is impossible to say for sure, but I think most likely it will be the space in your numbers. That makes your data a string, not a number. You could replace the space with a UTF8 narrow space, or a . (see this section of the manual) and then it should work.

    If you want a regular space, use an unformatted number in the source data and a renderer to render the data.

    Allan

  • cernochcernoch Posts: 2Questions: 0Answers: 0

    It was the space, so problem solved.

    Thank's for help.

    Jirka

This discussion has been closed.