• python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Facebook Twitter Instagram
Devs Fixed
  • python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Devs Fixed
Home ยป Resolved: Trying to map response in table but not getting expected output

Resolved: Trying to map response in table but not getting expected output

0
By Isaac Tonny on 16/03/2023 Issue
Share
Facebook Twitter LinkedIn

In this post, we will see how to resolve Trying to map response in table but not getting expected output

Question:

As I am trying to add rowspan attribute in table cell it only showing two rows only and third name showing in other column as well getting problem in mapping children name. the expected output will be 2 rowspan for first id of object and 1 rowspan for second id of object and 2 rowspan for second id of object and same for user_name. Expected table attached below enter image description here

Best Answer:

I couldn’t comment so I am adding an answer here with a potential solution.
So I found that you have a typo of sorts, you didn’t write your second map function correctly, this is how it should be:
I hope this helps, in case it’s not helpful, please provide a screenshot or something of what you’re seeing and maybe explain with a sketch what you want to do as well, I’ll do my best to help you out!
Edit: According to your sketch I think this should work, the trick is to lay out the first element of the children array first with the other data, and then use slice to remove the first element and loop through the rest to add them to the table.
You should also make sure that the data you received does have children, for example by checking the length before starting to display your data, just as a safety measure.
This is how it looks: enter image description here

If you have better answer, please add a comment about this, thank you!

Source: Stackoverflow.com

frontend javascript react-native reactjs user-interface
Share. Facebook Twitter LinkedIn

Related Posts

Resolved: How to compare two text files and and change the sign of the data in powershell?

27/03/2023

Resolved: Java Virtual Machines deleted

27/03/2023

Resolved: PyCharm cannot see my newly compiled .pyc see on import

27/03/2023

Comments are closed.

© 2023 DEVSFIX.COM

Type above and press Enter to search. Press Esc to cancel.