Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I am working with react, I want to create a material-ui table with certain caracteristics. I have an array of elements where every element represent a column of the table, each column's elemnt has a name and a number of how many cells cover.

so for example a column is something like this:

    column1 =[
{name: 'A1', cells:2 },
{name: 'A2', cells:1},
{name: 'A3', cells:2},
{name: 'A4', cells:3},
...
]

column2 =[
{name: 'B1', cells:4 },
{name: 'B2', cells:1},
{name: 'B3', cells:3},
{name: 'B4', cells:1},
...
]

And the whole table array is something like:

table=[column1, column2,...]

the result of column1 and column2:

enter image description here

I need something similar to Mui.TableRow but for iterate columns.

I know that every cell would be like this:

{column1.map((e) => {
    <Mui.TableCell style={{border: '4px solid grey'}} rowSpan={e.cells} >
         {e.name}
     </Mui.TableCell>
}

But I dont know how to separate each column.

If someone could give me advice of how to do this or another approach it would be great.

Thanks!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
210 views
Welcome To Ask or Share your Answers For Others

1 Answer

等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...