Skip to content
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] Editable Cell Tabbing #12214

Closed
Zasheus opened this issue Feb 26, 2024 · 10 comments
Closed

[data grid] Editable Cell Tabbing #12214

Zasheus opened this issue Feb 26, 2024 · 10 comments
Labels
component: data grid This is the name of the generic UI component, not the React module! feature: Editing Related to the data grid Editing feature status: waiting for author Issue with insufficient information support: commercial Support request from paid users support: question Community support but can be turned into an improvement

Comments

@Zasheus
Copy link

Zasheus commented Feb 26, 2024

The problem in depth

I am currently using DataGrid for CRUD with the single click edit recipe. I need the edit mode to be "cell" as I fill in non editable cells with data on an edit cell commit. However, I want the user to be able to tab from one editable cell to another, like how "row" edit mode works. Ideally when it is the last cell it should go to the next row to.

Whats the best option to do this? Thanks

Your environment

`npx @mui/envinfo`
  Don't forget to mention which browser you used.
  Output from `npx @mui/envinfo` goes here.

Search keywords: Focus, Tab
Order ID: 75414

@Zasheus Zasheus added status: waiting for maintainer These issues haven't been looked at yet by a maintainer support: commercial Support request from paid users labels Feb 26, 2024
@Zasheus Zasheus changed the title [DataGrid] [DataGrid] Editable Cell Tabbing Feb 26, 2024
@oliviertassinari oliviertassinari added the component: data grid This is the name of the generic UI component, not the React module! label Feb 26, 2024
@michelengelen
Copy link
Member

michelengelen commented Feb 27, 2024

I am not sure I do understand you requirement.
From what I understood setting the editMode to 'row' would be what you want.
If you need 'non-editable' cells you can just disable that in the column definitions, or by using the isCellEditable method. That one is highly customizable to fit your specific needs as well.

Exmaple:

const isCellEditable = (params: GridCellParams) => {
  if (params.field === 'age' && params.value < 25) {
    return false;
  }
  return true;
};

@michelengelen michelengelen added status: waiting for author Issue with insufficient information feature: Editing Related to the data grid Editing feature support: question Community support but can be turned into an improvement and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Feb 27, 2024
@michelengelen michelengelen changed the title [DataGrid] Editable Cell Tabbing [data grid] Editable Cell Tabbing Feb 27, 2024
@Zasheus
Copy link
Author

Zasheus commented Feb 27, 2024

Essentially I have a cell where I can enter a code, and from that code I fetch data and set column data onProcessRowUpdate. This works as I expect since it’s in cell edit mode. However, in row edit mode, the fetch data will only populate once I exit out of editing the WHOLE row, rather than that specific cell.

So if I were to be able to get the tabbing functionality of row edit mode, but all the processes handle the same way as cell edit mode, this would be ideal.

@github-actions github-actions bot added status: waiting for maintainer These issues haven't been looked at yet by a maintainer and removed status: waiting for author Issue with insufficient information labels Feb 27, 2024
@michelengelen
Copy link
Member

Oh, that's an interesting use case. @romgrk is it possible to update cell values "mid-edit"?

@romgrk
Copy link
Contributor

romgrk commented Feb 27, 2024

I don't think so, that's a new feature or change we'd need to make.

How about we add a processCellUpdate callback to complement processRowUpdate?

@mui/xgrid Thoughts?

@michelengelen
Copy link
Member

Sounds like a good idea, but how can that help with this specific use case?
He would still need to exit edit mode, update and then re-enter edit mode if i understood that correctly

@cherniavskii
Copy link
Member

Hi @Zasheus
I've forked and modified the single-click editing demo: https://stackblitz.com/edit/react-u9chwq?file=Demo.tsx
Is this the behavior you're looking for?

@Zasheus
Copy link
Author

Zasheus commented Feb 28, 2024

Hey @cherniavskii, thanks a lot for that. I managed to get the implementation I wanted through the help of your demo. Let me know if there's a more elegant solution to this though 😂 https://stackblitz.com/edit/react-u9chwq-ypaysx?file=Demo.tsx

@cherniavskii
Copy link
Member

@Zasheus Looks good to me!
While it's quite verbose, I don't have a more elegant solution, unfortunately.

@cherniavskii cherniavskii added status: waiting for maintainer These issues haven't been looked at yet by a maintainer status: waiting for author Issue with insufficient information and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Mar 4, 2024
@michelengelen
Copy link
Member

Thanks @cherniavskii for the confirmation. Since this seems resolved I will close the issue now. @Zasheus feel free to reopen if you encounter any problems with the solution! Thanks!

Copy link

github-actions bot commented Mar 8, 2024

⚠️ This issue has been closed.
If you have a similar problem, please open a new issue and provide details about your specific problem.
If you can provide additional information related to this topic that could help future readers, please feel free to leave a comment.

How did we do @Zasheus?
Your experience with our support team matters to us. If you have a moment, please share your thoughts through our brief survey.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: data grid This is the name of the generic UI component, not the React module! feature: Editing Related to the data grid Editing feature status: waiting for author Issue with insufficient information support: commercial Support request from paid users support: question Community support but can be turned into an improvement
Projects
None yet
Development

No branches or pull requests

5 participants