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

Passing the user event to the cell editor #276

Closed
SabreWolf opened this issue Sep 20, 2018 · 5 comments
Closed

Passing the user event to the cell editor #276

SabreWolf opened this issue Sep 20, 2018 · 5 comments

Comments

@SabreWolf
Copy link

There are times when the cell editor should initialize differently depending on how the cell editor request came about. Whether that be a certain key press or mouse click. (Excel does this)

Please can you include the user event object as a field in the args object that gets passed to the constructor of the cell editor. I am happy to provide a code patch if you think it would be helpful.

@6pac
Copy link
Owner

6pac commented Sep 21, 2018

PRs are always welcome!

Also, check out 'PreClick mode' here: https://github.com/6pac/SlickGrid/wiki/Writing-custom-cell-editors
This was specifically designed to allow direct clicking on checkboxes without having to enter edit mode first.
It's not what you've suggested, but may help.

@SabreWolf
Copy link
Author

Thanks for your response. I had a look at the link you included but it doesn't meet my requirements unfortunately.

I am looking to have a custom text cell editor (which I have already written following one of the guides). The requirement is to essentially have it behave like excel. I have set the autoedit feature to "off" so that a cell edit only happens on an "enter" key press or a mouse double click. If the cell has text in it and is active but not in edit mode, then a key press of say "a" should causes the cell to jump into edit mode, wipe out the current value and write "a" in the editing text box. However, if the user presses F2, then the cell should go into edit mode with the existing value defaulted.

I am aware that the Excel requirement is very specific for me, which is why I have written my own cell editor, but in order for me to get my editor to behave correctly on initialization, I need to know what event happened beforehand.

I have everything working in my local copy, it just required the event argument to be passed through all the way to the editor's constructor.

@6pac
Copy link
Owner

6pac commented Sep 22, 2018

Email me the changed files if you like, and I'm happy to patch the hooks in to the repo. What I look for when considering changes is the general usefulness across a range of plugins or use cases, and it sounds like this fits the bill. You may as well send the editor as well, it would be a useful example of how to use this new hook.

6pac added a commit that referenced this issue Dec 6, 2018
…injector to columnpicker and cellexternalcopymanager. Add ability to export header row to cellexternalcopymanager.
@6pac
Copy link
Owner

6pac commented Dec 6, 2018

I've added these patches and pushed to the repo. Will do a release (NPM etc) soon. Sorry about the really long delay!

@6pac 6pac closed this as completed Dec 6, 2018
@SabreWolf
Copy link
Author

Many thanks, much appreciated.

ghiscoding added a commit that referenced this issue Dec 20, 2018
injector to columnpicker and cellexternalcopymanager. Add ability to export header row to cellexternalcopymanager.
as per commit 0abf432
alhoo pushed a commit to alhoo/SlickGrid that referenced this issue Dec 22, 2018
…ame injector to columnpicker and cellexternalcopymanager. Add ability to export header row to cellexternalcopymanager.
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