-1

I have a Column Component, and I'm trying to display these two data points with a break line, please help.

right now the result is:

BusinessName UserName

I'd like:

BusinessName

UserName

<Column
     calculateCellValue={(cellData: { BusinessName: string; UserName: string }) => 
     `${cellData.BusinessName} ${cellData.UserName}`}
/>
karinapichardo
  • 67
  • 2
  • 10
  • 1
    What does `Column` do with `calculateCellValue`? – Nicholas Tower Apr 23 '22 at 18:42
  • it displays custom values, in my case it allows me to display 2 values vs just one @NicholasTower – karinapichardo Apr 23 '22 at 18:48
  • `it displays custom values, in my case it allows me to display 2 values vs just one` That doesn't really answer my question. Can you show the code? Like, is it doing `
    {calculateCellValue(someData)}
    `? If you need `calculateCellValue` to return a string, that will change the set of possible solutions, compared to what you can do if returning a react element is ok. You've already gotten answers that suggest adding `"\n"` or `"
    "`, because people have made guesses about what you're doing with the calculateCellValue; guesses which turned out to be incorrect.
    – Nicholas Tower Apr 23 '22 at 18:50
  • Seems like `` is an object that is used to render a column header. Wonder if one may use styling (ie, "CSS") on that element to display its contents one below the other. – jsN00b Apr 23 '22 at 18:51
  • calculate cell value returns an object @NicholasTower – karinapichardo Apr 23 '22 at 19:00
  • `calculate cell value returns an object @NicholasTower` Not in the code you provided. You showed it returning a string, and i'm asking what `Column` does with that string. If it's returning an object, ok that's fine, but i'll still need to see what `Column` does with that object. – Nicholas Tower Apr 23 '22 at 19:08

2 Answers2

-1

insert "\n" :

<Column
     calculateCellValue={(cellData: { BusinessName: string; UserName: string }) => 
     `${cellData.BusinessName} +"\n" +${cellData.UserName}`}
/>
debugger
  • 1,442
  • 1
  • 9
  • 14
-1

You should probably share the source code for the Column component as well, but see if this one works:

<Column
     calculateCellValue={(cellData: { BusinessName: string; UserName: string }) => 
     `${cellData.BusinessName}\n${cellData.UserName}`}
/>
Nick Rameau
  • 1,258
  • 14
  • 23