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

150
Views
js join("\n") no comienza en la nueva línea

Estoy usando una tabla Ant Design, y esta es una de mis columnas. Me gustaría mostrar todos los nombres en una nueva línea, y estoy usando "\n", pero no funciona, solo agrega espacios, no comienza el segundo nombre en la nueva línea.

 { 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

Otra solución es usar la etiqueta HTML (he usado la etiqueta de párrafo, puede usar la etiqueta br), esto mostrará todos los nombres en una nueva línea.

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

O

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

0

@Ayuda Intenté unirme(<br/>) y unirme("<br/>"), pero ambas no funcionaron;

join(<br/>) dará error join("<br/>") considerará esto como un separador

 (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.

Puede mapear el registro y agregar una etiqueta <br/> como esta:

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

0

La función map () debería devolver algo, debería ser así:

 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!