-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[data grid] How can I trigger a new row being added after the processRowUpdate callback? (Only after adding a new row, not editing an existing row) #13135
Comments
Hey @Luis-Ramirez21x Would that be a sufficient solution for you? @cherniavskii another candidate for a new recipe? |
@michelengelen Thank you for responding so quickly! I'm not able to access your demo, are you able to open up permissions on it? |
@Luis-Ramirez21x it should now be public ... sry for the confusion! |
@michelengelen Does it work for you? The focus doesn't move to the first column: Screen.Recording.2024-05-15.at.17.26.21.movPassing |
@michelengelen no worries, I can see the demo now. The demo is a close solution, but I encountered an issue with mismatching IDs when creating a new row and then retrieving the updated 'valid' row id from the server. The process issue :
Your demo did point me in the right direction though. I added a few lines to process row update to get what I needed.
Although I'm not sure if this is the most efficient way to do this. What do you think? working_demo.mp4 |
Sorry for the spammed comments. This seems to do the trick, just seems a bit slower and a visible flicker of the focused cell is seen.
Demo of focused cell flicker: focus_flicker.mp4 |
Here's a simplified sandbox of the above |
This is strange. Could you compare I just noticed that you are trying to call Could you check that please? |
Hey @michelengelen!
The So what happens is:
I say all this to say that the previous code snippet provided seemed to do the trick. Now I just have to figure out what's affecting the focus state. I think this issue is good to close. Thanks for taking the time to help! |
OK, so you get a server side I guess this should be doable still. I tried setting a constant value for the new rows id and that does work indeed, but the newly added row from the server will always be added at the bottom. Then the order is messed up. @romgrk is there a way we can have an empty row that always sits at the last place? Or can we update the index in some way? @Luis-Ramirez21x would row pinning be an option? |
I have tried the simplified sandbox linked above and I can't reproduce the flicker in the video. If you need further assistance, would it be possible to reproduce the issue in the sandbox? I'm not sure if there is a way to always have an empty row at the bottom, but it should be possible to remove/add it in the same operation as the new server row is received, which should get rid of the flicker I think. |
@romgrk That fixed the flicker issues I was having. It's working perfectly now 👍 ! |
If you could point me towards what that fix might've been that would be awesome, just out of curiosity 😁 . |
I don't know what fixed it, we changed a lot in v7. Let us know if there's anything else we can do, otherwise you can close the issue. |
@Luis-Ramirez21x: How did we do? Your experience with our support team matters to us. If you have a moment, please share your thoughts in this short Support Satisfaction survey. |
Hey @romgrk @michelengelen! I need your guidance once again. Turns out the flicker is still occurring. See this updated demo . |
i'll close and reopen in a sperate issue |
@Luis-Ramirez21x: How did we do? Your experience with our support team matters to us. If you have a moment, please share your thoughts in this short Support Satisfaction survey. |
The problem in depth
I'd like the grid to auto-add a new row with a random ID only when:
It should not auto-add a new row when a row is edited. The new row should be autofocused on as well.
Use case:
Our users often have to perform a lot of data entry. If they could simply hit enter, and the current row would save and the next one would open that would be fantastic.
Currently users have to :
-input data
-hit enter
-tab to the add button
-hit enter again
Ideally users just:
-input data
-hit enter
Am I overlooking some event listener that's triggered after proccessRowUpdate?
Thanks in advance!
I've created a simplified sandbox from a combination of the Server Side example and the Full CRUD example
This is what their flow currently looks like
adding_row_improvement.mp4
Your environment
`npx @mui/envinfo`
Search keywords: Auto add row, processRowUpdate,
Order ID: 67382
The text was updated successfully, but these errors were encountered: