Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

151
Views
js join("\n") not start at new line

I am using an Ant Design table, and this is one of my columns. I would like to show every name on a new line, and I'm using "\n" but it's not working - it only adds spaces, it doesn't start the second name at the new line.

{
    title: "Borrower Name",
    width: 150,
    dataIndex: "borrower",
    render: (record) => record.map((a) => a.name).join("\n"),
}
about 4 years ago · Juan Pablo Isaza
3 answers
Answer question

0

Another solution is using HTML tag (i have used paragraph tag, you can use br tag), this will display all the names on new line.

{
  title: 'Borrower Name',
  width: 150,
  dataIndex: 'borrower',
  render: (record) => record.map((a) => <p>{a.name}</p>),
},

Or

{
  title: 'Borrower Name',
  width: 150,
  dataIndex: 'borrower',
  render: (record) => record.map((a) => <>{a.name}<br/></>),
},
about 4 years ago · Juan Pablo Isaza Report

0

@Help I tried join(<br/>) and join("<br/>"),but both not working;

join(<br/>) will give error join("<br/>") will consider this as separator

(method) Array<string>.join(separator?: string | undefined): string
Adds all the elements of an array into a string, separated by the specified separator string.
@param separator — A string used to separate one element of the array from the next in the resulting string. If omitted, the array elements are separated with a comma.

You can map over the record and add a <br/> tag like this:

render: (_: any, row: any) =>['a', 'b'].map((item) => (<>{item}<br /></>))
about 4 years ago · Juan Pablo Isaza Report

0

map() function should return something, Should be like this:

render: (record) => record.map(a => {return a.name}).join("\n")

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!