You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to add a feature that allows the user to create a new child under an specific node (in a tree grid) but I'm not being able to make it.
I'm using the following event handler in for the menu action:
EVENT_HANDLER: ({ metaData }) => {
const rowIndex = metaData.rowIndex + 1
store.dispatch(Actions.EditorActions.addNewRow({
stateKey,
rowIndex,
columns,
data: {
id: "666",
parentId: metaData.rowData._id,
children: [],
name: 'some name',
description: 'some description'
}
}));
}
This code adds a new row but NOT under the parent node (just adds it below it as a sibling) and most importantly, it throws some errors like this one:
From debugging I see the problem is that the variable treeData is empty (all its properties are an empty string or null, etc) in the Cell class. In particular, the "depth" prop inside the treeData json is an empty string.
I guess I'm probably doing something wrong in the rest of my code but I couldn't find any example that shows how to add new rows to the grid.
If you have any sample code of this I would really appreciate it...
Thanks in advance!
Cheers
The text was updated successfully, but these errors were encountered:
We are facing the same problem. From what I understand, the object in memory has the wrong data format.
We could potentially create our own Action+Reducer and use internals of React-Redux-Grid to build up a new item. I believe the code is not too far from setPartialTreeData in src/reducers/actionHelpers/datasource.js. (which, I think, updates the childrens of a node after a partial load)
Even with that, as soon as I use the inline-editor and save, drag&dropping items in the grid stops working.
The repository hasn't been updated since February, I think I might end up creating my own inline insert state by overriding the row renderer.
Hi Ben,
I'm trying to add a feature that allows the user to create a new child under an specific node (in a tree grid) but I'm not being able to make it.
I'm using the following event handler in for the menu action:
EVENT_HANDLER: ({ metaData }) => {
const rowIndex = metaData.rowIndex + 1
store.dispatch(Actions.EditorActions.addNewRow({
stateKey,
rowIndex,
columns,
data: {
id: "666",
parentId: metaData.rowData._id,
children: [],
name: 'some name',
description: 'some description'
}
}));
}
This code adds a new row but NOT under the parent node (just adds it below it as a sibling) and most importantly, it throws some errors like this one:
From debugging I see the problem is that the variable treeData is empty (all its properties are an empty string or null, etc) in the Cell class. In particular, the "depth" prop inside the treeData json is an empty string.
I guess I'm probably doing something wrong in the rest of my code but I couldn't find any example that shows how to add new rows to the grid.
If you have any sample code of this I would really appreciate it...
Thanks in advance!
Cheers
The text was updated successfully, but these errors were encountered: