When I use the "currency" in a dynamic column, I see that there are no options to choose the currency code and numbers end up looking like "XXX 123.45", which looks like there is no currency that has been chosen. Is there a way for me to set the currency code to USD?
Is there a way to do this through code? The table I have has a dynamic number of columns and going through the UI for each column is going to be a hassle. I have 60+ columns.
I assume yes, but it may require you to know what each of the column names/labels are when the table is built? Assuming you're building this table dynamically? Is the table based on a payload? Are the columns being added to the table after it is initially built?
The more information you provide, the better as it will help the forum participants help you find a solution quicker. If not me then someone else (which is more likely )
Just to give you an example, I added a custom column and set it to currency
But I don't know if this can be done while the table is being generated... may require more work before it gets displayed in the component. Again more information will be more helpful to help you.
Yea here's what I'm trying to do.
I have a selector that gets data in % or $ depending on what is being selected. Because of this, I need to dynamically change what the column type is (i.e. 'percent' or 'currency'). So I am using a transformer that looks like the following in the Dynamic Columns:
var arr = []
if ({{isPercent.value}}) {
for (var i = 0; i < {{ formatDataAsArray(getData.data).length }}; i++) {
arr.push({"name": i.toString(), type: "percent"});
}
} else {
for (var i = 0; i < {{ formatDataAsArray(getData.data).length }}; i++) {
arr.push({"name": i.toString(), type: "currency"});
}
}
return arr;
However, once I run this, I can't fill in the currency_type (USD) dynamically as well. Causing the problem I see able.
Hey @ohynot, stepping in here!
Out of curiosity, have you tried entering a "Currency code" when your column is dynamically set to "Currency" type?
Here's a quick GIF of my setup working! I saw the XXX too, until I entered the currency code
dynamic currency column.gif
Hey Victoria,
I can do that but there are more than 80+ columns so doing it manually is a bit painful. There isn't a more dynamic way to do this?
Tony
Ah darn. I don't think so, but let me check!
Quick update! I've been trying to figure this out for you and have hit quite a few dead ends, with the exception of one potential path.
Are you tied to using the currency column? If not, you could add a mapper to add a column mapper to do something like prepend a "$".
arr.push({"name": {{Object.keys(getData.data)}}[i], type: "string", mapper: "{\{ '$' + self }\}" })
Docs on using this mapper
property in the dynamic column settings!