onCurrentIndexChanged not firing

{UPDATE}
Here’s some code that ALMOST works… for the first time the index changes, the repeater’s Formatted Price changes perfectly… but the second time that the index changes, the repeater’s formatted data changes to a NaN. Thoughts???

$w.onReady( function () {
$w(“#dynamicDataset”).onReady(() => {
console.log(‘ready’)
populateFormattedPrice();
} );

$w(“#dynamicDataset”).onCurrentIndexChanged( (index) => {
console.log(‘index has changed’)
populateNewFormattedPrice();
} );

} );

function populateFormattedPrice() {
$w(“#dynamicDataset”).onReady(() => {
$w(‘#repeater1’).forEachItem( ($item, itemData, index) => {
const numberWithCommas = (x) => {
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, “,”);
}
$item(‘#priceText’).text = “$” + numberWithCommas(parseInt($item(‘#priceText’).text, 10));
} );
});
}

function populateNewFormattedPrice() {
$w(“#dynamicDataset”).onReady(() => {
$w(‘#repeater1’).onItemReady( ($newItem, itemData, index) => {
console.log(‘new item ready’)
const numberWithCommas = (x) => {
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, “,”);
}
$newItem(‘#priceText’).text = “$” + numberWithCommas(parseInt($newItem(‘#priceText’).text, 10));
} );
});
}