mui / material-ui

Material UI: Ready-to-use foundational React components, free forever. It includes Material UI, which implements Google's Material Design.
https://mui.com/material-ui/
MIT License
92.32k stars 31.8k forks source link

Autocomplete in Data Grid - Editing #40135

Open bhaviklotia23 opened 6 months ago

bhaviklotia23 commented 6 months ago

Duplicates

Latest version

Summary 💡

User should be able to use Autocomplete component into Data-grid editing feature. Right now, Issue while using Autocomplete in Datagrid is when I search some keywords through options and I put space between keywords, It looses focuses and on press of space key for spacing, my screen scrolls down. Although, I have not set editing flag as true because when this flag sets to true, That particular cell works as TextField instead of Autocomplete.

User can able to implement all types of Autocomplete component into datagrid cell including searchability and add new option in options list as well. MicrosoftTeams-image (1) MicrosoftTeams-image

Examples 🌈

Autocomplete in datagrid cell instead of textfield.

Motivation 🔦

Trying to implement this feature in one of my web application having datagrid component. It has Autocomplete in one cell. When user has searched with some keyword and if that keyword has space between two charecters, It scrolls down to last sell right now which is not an expected behaviour. Expected behaviour should be it should allow user to put space between two charecters while searching.

mj12albert commented 6 months ago

@bhaviklotia23 Can you provide a minimal repro? You can fork this template: https://mui.com/r/issue-template-latest

PS here are some tips: https://stackoverflow.com/help/mcve

bhaviklotia23 commented 6 months ago

https://657300646087887f910f124c--poetic-cannoli-78d02d.netlify.app/ (Live Demo) https://stackblitz.com/edit/react-awpmkn?file=src%2FTextDrop.js (CodeSandbox example)

Here is the link of demo. You can check autocomplete column. When I type something in autocomplete and put space between two characters by press space bar key, It looses focuses on that cell and scroll down the screen

Thanks & Regards, Bhavik

On Fri, 8 Dec 2023 at 12:21, Albert Yu @.***> wrote:

@bhaviklotia23 https://github.com/bhaviklotia23 Can you provide a repro? You can fork this template: https://mui.com/r/issue-template-latest

— Reply to this email directly, view it on GitHub https://github.com/mui/material-ui/issues/40135#issuecomment-1846634464, or unsubscribe https://github.com/notifications/unsubscribe-auth/AX6BDZTR24KRTKDH36OLAXTYIK2I7AVCNFSM6AAAAABALAXGJWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNBWGYZTINBWGQ . You are receiving this because you were mentioned.Message ID: @.***>

kelkmere commented 1 month ago

@bhaviklotia23 Did you find a solution?

bhaviklotia23 commented 1 month ago

@bhaviklotia23 Did you find a solution?

add editable=true. Whenever editable prop is true, try to set focus false for that particular cell.

(I don't have access to code right now but it was a solution for me at that time.)

shaliniganesan commented 4 weeks ago

could you pls share the code @bhaviklotia23. If editable prop set to true for autocomplete columns in the Data grid, autocomplete is not working.