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

Unable to paste on disabled cells #315

Open
akshaytanikatech opened this issue Aug 29, 2023 · 3 comments
Open

Unable to paste on disabled cells #315

akshaytanikatech opened this issue Aug 29, 2023 · 3 comments

Comments

@akshaytanikatech
Copy link

Yes i know you cannot paste on disabled cells, but in my scenario i've set up that "B column" should be disable until "A column" has any value in it, so whenever user pastes a row which includes both values, only "A column" value gets pasted.

Does any know any work way around?

@hussamkhatib
Copy link

It already works as you mentioned.
Focus on a column A cell and paste the 2 values.
Column A is changed to the first value of the pasted word, while Column B, the disabled column remains unchanged.

You can conditionall disable or enable columns based on the whether the value is present in Column A or not.
https://react-datasheet-grid.netlify.app/docs/api-reference/columns/#disabled

@akshaytanikatech
Copy link
Author

Thanks for reply,

I've a lot of columns in my sheet, In which there are some columns depends on other columns, until if they have any values in it will stays disable, So as specified in above example if user puts any value in "A column" the "B column" will become visible. But when i paste whole row, only visible columns the data gets pasted, and the disabled values don't, (they gets visible though because their depend column now has values).

Here is an example, try to copy first row and paste it on second, only visible cells will get pasted not the last name because it was disabled earlier

https://codesandbox.io/s/xenodochial-borg-yjp72c?file=/src/App.tsx

@hussamkhatib
Copy link

You can make use of pasteValue callback in that column
https://react-datasheet-grid.netlify.app/docs/api-reference/columns/#pastevalue

https://codesandbox.io/s/romantic-ardinghelli-k843sk?file=/src/App.tsx

I am not sure why it takes two attemps of pasting to get the desired result. i.e pasteValue is getting called when I paste it twice on Column A.
Hope that helps

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants