Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

152
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

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 Denunciar

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda