Skip to content

Going from TreeState to initial data format #31

@maewang00

Description

@maewang00

After the user finishes their edits on some rows in the table (using ), I was wondering if it is possible to convert the new modified TreeState into the same format as the data used to create the TreeState. How would I do such a thing?

Example:
const MOCK_DATA = [
{
data: { name: 'Company A', expenses: '105,000', employees: '22', contact: 'Makenzie Higgs' },
children: [
{
data: { name: 'Department 1', expenses: '75,000', employees: '18', contact: 'Florence Carter' }
}
]
}
];

...
treeValue: TreeState.create(MOCK_DATA)
...

and then after the edits/changes, we can turn treeValue into the below:

const NEW_MOCK_DATA = [
{
data: { name: 'Company A', expenses: '105,000', employees: '22', contact: 'John Doe' },
children: [
{
data: { name: 'Department 1', expenses: '75,000', employees: '18', contact: 'John Doe' }
}
]
}
];

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions