Topic: MDBDataTable custom data
                  
                  Sanket Patil
                  free
                  asked 4 years ago
                
How to access/iterate through nested objects
Expected behavior
Name    User ID Status  Action  updatedAt   packageId   packageStatus
Sanket  608c1de30f0b7d5f29d031a8    Completed   Collect 2021-05-12T09:46:25.124Z    DIGPAC2038855   Completed
Actual behavior
Name    User ID Status  Action  updatedAt   packageId   packageStatus
608c1de30f0b7d5f29d031a8    Completed   Collect 2021-05-12T09:46:25.124Z    DIGPAC2038855   Completed
Resources (screenshots, code snippets etc.)
const data = {
columns: [
{ label: 'Name',
field: 'userDetails.firstName',
sort: 'asc',
width: 150 },
.... others };
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Status
              Opened
Specification of the issue
              - ForumUser: Free
 - Premium support: No
 - Technology: MDB React
 - MDB Version: MDB4 5.0.1
 - Device: Laptop
 - Browser: Chrome
 - OS: Windows 10
 - Provided sample code: No
 - Provided link: No
 
Krzysztof Wilk staff commented 4 years ago
Hi!
Did you try to use
Object.keys(object)orObject.values(object)method? It will allow you to iterate through your objects. You can also try to write a recursive function with this method to get deeper value from other objects inside a previous one :)Keep coding!