T
TanStack16mo ago
national-gold

Nested Objects Woes

I have an object thus:
const getGanttRowLabels: TGanttData[] = [
locationDetails: {
locationId: 0,
locationRoleName: "TEAM LEADER",
locationArea: "N/A",
allowAllocation: true,
isStaffSpace: false
}
},
...... more enteries

]
const getGanttRowLabels: TGanttData[] = [
locationDetails: {
locationId: 0,
locationRoleName: "TEAM LEADER",
locationArea: "N/A",
allowAllocation: true,
isStaffSpace: false
}
},
...... more enteries

]
However, when i attempt to update this object using updateData in meta, all it does is create a new property to TGanttData rather than changing the property of locationDetails. I have tried many, many ways to do this. I have no problems displaying the data in the table. I am simply attempting to change the data object using an Input competent in the table, so essentially an Editable Table. I have even tried using the example on Tanstack: https://tanstack.com/table/latest/docs/framework/react/examples/editable-data and i am greeted with the same issue when i push in a nested data object. I have used assecorFn, accessor, id accessroKey etc with and without dot notation to no avail. Any suggestions would be appreciated. I'm pulling my hair out on this one
React TanStack Table Editable Data Example | TanStack Table Docs
An example showing how to implement Editable Data in React using TanStack Table.
1 Reply
national-gold
national-goldOP16mo ago
Well, to solve this, I had to extract the data from the locationDetails object into its own object. Now that it is a flat object, everything works... except for pushing data into switches or check boxes using getValue. Not sure why, but getValue does not like switches or check boxes.

Did you find this page helpful?