Skip to content

How to remove commas when rendering arrays in DataTable? #2044

Discussion options

You must be logged in to vote

If you are trying to show the data in one column as shown on the screenshot, you can either provide the data as a string with separator of your choice or write a function that would change it for you

const formatData = (data) => data.toString().replaceAll(",", " | ");

const basicData = {
  columns: ["Foo"],
  rows: [[formatData([1, 2, 3])], [[4, 5, 6]]],
};

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by avolutions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants