Hello everyone. I have this code I found here in the forum to display numbers in two table columns as currency (with comma separators and $ symbol). Although it does its job, I found it is interfering with the rest of my page codes so filters, buttons and other things stop working well. Any ideas?
import wixData from ‘wix-data’ ;
// For full API documentation, including code examples, visit Velo API Reference - Wix.com
export function button24_click(event) {
$w( ‘#dataset1’ ).setFilter(wixData.filter()
.contains( “title” , $w( ‘#input30’ ).value));
}
export function button16_click(event) {
$w( ‘#dataset1’ ).setFilter(wixData.filter());
$w( ‘#input30’ ).value = “”
}
$w.onReady( function () {
$w( “#dataset1” ).onReady(() => {
let rows = $w( “#table1” ).rows;
let count = $w( “#table1” ).rows.length;
for ( let i = 0 ; i < count; i++) {
let oldScore = rows[i][ “price” ]
console.log( "old score is " + oldScore);
var number = Number(oldScore)
console.log( "revised score is " + number.toLocaleString());
let revisedScore = number.toLocaleString();
rows[i][ “price” ] = ‘$’ + revisedScore;
let viejoScore = rows[i][ “precioArriendo” ]
console.log( "viejo score is " + viejoScore);
var number = Number(viejoScore)
console.log( "revised score is " + number.toLocaleString());
let revisadoScore = number.toLocaleString();
rows[i][ “precioArriendo” ] = ‘$’ + revisadoScore;
}
$w( ‘#table1’ ).rows = rows
})
})
You will need to provide more information for anyone to be able to provide assistance.
What you you trying to do? What is working? What isn’t working? What do you mean by " it is interfering with the rest of my page codes"?
Please realize that you can’t just “copy and paste” code and expect it to work. You need to understand what’s happening if you expect to be able to write code that does what you want.
Hi 
I don’t think that’s what causing the page stop working, sometimes you may encounter invisible errors that don’t come until you log them, so I suggest using the console to log where the code reach, give feedback on completed or rejected actions, put some logs every 2-3 lines to monitor where the code stops, and then narrow code further until you identify what’s causing the the code to stop, then log its error if it has any, or log the result to see what it gives you.
@Yisrael (Wix) and @Ahmad Thank you for answering and for your suggestions I will explain further.
All the code I copied has been adapted to my website and needs so no problem with that. I have a real estate website and I have created a dashboard where I cann see a full list of my properties in a table. The first part of the code regards a search bar so I can find properties by title or agent name. This code works great UNLESS I add the second part of the code which adds comma separators and $ symbols so the property prices are displayed as currency. This second part works great, it displays the numbers as I want, but it prevents my search bar to display the results I search in my table. Here is a screenshot. As you see I have no errors in my console and it seems like everything is fine when I click my search button but the table isnt displaying the results as it should. Please see below for further detail.
FIRST PAR OF THE CODE (performs great until I add the second part of the code):
import wixData from ‘wix-data’ ;
// For full API documentation, including code examples, visit Velo API Reference - Wix.com
export function button24_click(event) {
$w( ‘#dataset1’ ).setFilter(wixData.filter()
.contains( “title” , $w( ‘#input30’ ).value)
.or(wixData.filter().contains( “agentName” , $w( ‘#input30’ ).value))
);
}
export function button16_click(event) {
$w( ‘#dataset1’ ).setFilter(wixData.filter());
$w( ‘#input30’ ).value = “”
}
SECOND PART OF THE CODE (performs great always but it prevents the first part of the code to perform as it should):
$w.onReady( function () {
$w( “#dataset1” ).onReady(() => {
let rows = $w( “#table1” ).rows;
let count = $w( “#table1” ).rows.length;
for ( let i = 0 ; i < count; i++) {
let oldScore = rows[i][ “price” ]
console.log( "old score is " + oldScore);
var number = Number(oldScore)
console.log( "revised score is " + number.toLocaleString());
let revisedScore = number.toLocaleString();
rows[i][ “price” ] = ‘$’ + revisedScore;
let viejoScore = rows[i][ “precioArriendo” ]
console.log( "viejo score is " + viejoScore);
var number = Number(viejoScore)
console.log( "revised score is " + number.toLocaleString());
let revisadoScore = number.toLocaleString();
rows[i][ “precioArriendo” ] = ‘$’ + revisadoScore;
}
$w( ‘#table1’ ).rows = rows
})
})
Here is the link to this page if you want to check.
A futher issue I have is if I add a log more button for the table to load more properties it wont work neither. Why is all this happening here?
I hope this explaination is better. Thank you for your time and patience 
Does your collection has the price as a number or as a text, for example (1500) or ($1,500)?
Also, you’re providing the editor URL, which is inaccessible for everyone except its owner and Wix authorized personnel, the only way a non-wix user can access your editor is by sending him an admin invitation.
What page are you having the problem? I can’t find any page on your site that has the code that you have posted.
Also, most of the pages have multiple errors that would prevent the page or site from working properly. As I mentioned earlier, it’s not enough to just copy code that you find on the forum - you need to know precisely what it does and how.
On one of your pages (Mis Immuebles), you have this section of code:
export function button25_click(event) {
$w.onReady(function () {
$w("#dataset2").onReady(() => {
let rows = $w("#table1").rows;
let count = $w("#table1").rows.length;
for (let i = 0; i < count; i++) {
let oldScore = rows[i]["price"]
console.log("old score is " + oldScore);
var number = Number(oldScore)
console.log("revised score is " + number.toLocaleString());
let revisedScore = number.toLocaleString();
rows[i]["price"] = '$'+revisedScore;
}
$w('#table1').rows = rows
})
What you have here is the page’s onReady() function inside of a button onclick event handler. This code just won’t work.
You will need to learn about programming with Corvid. Read the following articles that will help you start working with Corvid:
-
About Corvid by Wix - what Corvid is and what features it has.
-
Getting Started with Corvid by Wix - step-by-step tutorial on how to start using Corvid.
-
Onboarding to Corvid by Wix - introduction to Corvid with short tutorials.
If you find that you are having difficulty with code and need assistance, you may want to check out the Wix Marketplace - it’s a place where you can look for Corvid experts for hire.
Thank you @Yisrael for all those links. I am learning everyday more about it since I am obviously a beginner :). The page I am talking about is called “LISTA DE INMUEBLES” and is a dashboard page. I am currenly informing myself more in order to improve all my coding. So far this page is one of the many I have to improve.
My collection has the price fields set as number 