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"), }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/></>), },@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 /></>))La función map () debería devolver algo, debería ser así:
render: (record) => record.map(a => {return a.name}).join("\n")