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

Categories

0 votes
225 views
in Technique[技术] by (71.8m points)

Is there a way to define row data in react-table?

I've been tasked to build a table that will compare the results of two objects:

[
  {
      id: 1,
      source:{
         name: 'foo',
         type: 'bar',
      },
      match:{
         name: 'foo',
         type: 'baz',
         description: 'some desc'
      }
   },
  {
      id: 2,
      source:{
         name: 'bar',
         type: 'baz',
      },
      match:{
         name: 'foo',
         type: 'bar',
         description: 'another desc'
      }
   },
]

I would like to generate a table with columns source, match. Then, with useGroupBy, group the rows by the object id. However, I need the data to display in rows, using both object's keys: id, name, type, description:

End result would look like this table

Is this possible in react-table or should I attempt a different implementation? Just need a pointer, I know this is a very open ended question.


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

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...