Number formatting and Sorting in a Repeater

Hi brolloks and Titanlists,

You can sort numbers with commas by using the toLocaleString JavaScript method. The toLocaleString method will automatically insert commas at the appropriate places when called on a number. My coworker Anthony posted more information about this, here:

https://www.axure.com/c/forum/7-0-tips-tricks-examples/11615-number-format-thousands-separator-input-number.html#post63567

So let’s say you had a column called “Column0” with various long-string numbers. To format these with commas, edit the Set Text interaction of the repeater’s OnItemLoad to:

[[(Item.Column0*1).toLocaleString()]]

If you wanted the “$” character in there as well, add this to the front, outside of the double brackets:

$[[(Item.Column0*1).toLocaleString()]]

Any sort interactions will work with the above methods. Hopefully this helps!
NumberFormatting.rp (53.3 KB)

3 Likes