-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding a new row with the same name as an existing row causes the grid to override the current row. #8131
Comments
Hi @Maddy-O In Tree Data structure, getDataPath() should return a unique value for each row. If you would like to add a row with the same data you would have to get the grid to use a different display value. In your case you could use "field" as a display name. See the following example: Hope this helps. Please close the issue if this answer resolves your issue |
I also encountered the same problem. There was no warning in the previous version. Of course, the data was also unique. |
As I mentioned previously the issue here is that you are using the same key for the new record. The correct behaviour is that the new data shouldn't be added and you would see a warning in console if you try to add a record with same key returned from We have an internal ticket for changing this behavior so that neither the replacement nor adding would happen |
[
{
"MenuId": 66282708992000,
"MenuPid": 0,
"MenuName": "仪表盘",
"$dataPath": [
"66282708992000"
]
},
{
"MenuId": 66987521585152,
"MenuPid": 66987169697792,
"MenuName": "系统菜单",
"$dataPath": [
"66987169697792",
"66987521585152"
]
},
{
"MenuId": 66987789955072,
"MenuPid": 66987169697792,
"MenuName": "系统日志",
"$dataPath": [
"66987169697792",
"66987789955072"
]
},
{
"MenuId": 66987169697792,
"MenuPid": 0,
"MenuName": "系统管理",
"$dataPath": [
"66987169697792"
]
}
] |
#8097
@sabahang For better reference, I am attaching a short video about what I want to achieve. In this video, I am trying to add a new row, ABL, which is already present in the grid. The first time I add the row, it overrides the data. The second time, it adds the row. The third time, it does not add the row, but on the fourth attempt, it adds the row again. This random behavior is a bit confusing.
add-row-issue.1.mp4
Here is a plnkr live example for adding new row - https://codesandbox.io/p/sandbox/org-hierarchy-forked-khpt4x?file=%2Fsrc%2Findex.tsx%3A69%2C27
I would greatly appreciate any guidance or instructions on how to implement this feature effectively.
The text was updated successfully, but these errors were encountered: