For anyone still having trouble using .toLocaleString() to display commas to a Number Field from a dataset in a repeater, here’s the code that I used which works perfectly for me:
$w . onReady ( function () {
$w ( “#yourDataset” ). onReady (() => {
$w ( “#yourRepeater” ). forEachItem (( $item , itemData , index ) => {
let number = Number ( $item ( “#repeaterTextBox” ). text ). toLocaleString ();
$item ( “#repeaterTextBoxID” ). text = number ;
})
})
});
Plug in the ID’s for your page’s elements and this should display the number values in “#repeaterTextBox” with commas in them in preview/Live after the page loads.
If you also have dynamic pages for each of your dataset/repeater items, you can add this code in those pages as well:
$w . onReady ( function () {
$w ( “#yourDataset” ). onReady (() => {
let number = Number ( $w ( “#textBox” ). text ). toLocaleString ();
$w ( “#textBox” ). text = number ;
})
});
Note: Remember that the element ID’s may be be different in this page so make sure you change them accordingly if that’s the case