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

fix: Editor.keyCaptureList is an array of numbers #1006

Merged
merged 2 commits into from
Apr 2, 2024

Conversation

AlexandrChazov
Copy link
Contributor

The 'keyCaptureList' variable of the Editor class is an array of numbers.

@ghiscoding
Copy link
Collaborator

hmm are you sure about this? I actually don't know what that is for, I think @6pac added this (Ben do you have more info and can you do a review?). @AlexandrChazov if you do have more info of what that does then please add a description to the interface property because I didn't add one because I didn't know what it actually was for.

@6pac
Copy link
Owner

6pac commented Apr 2, 2024

Yep, it should be an array of numbers. It allows codes that would normally be captured by the grid to be routed to the editor instead. For example, up and down might be used to traverse up and down a dropdown list where normally the grid would capture the keystrokes and move up or down a cell.

Sample code from my personal repo:

function SingleDropDownEditor(args) {
  var $input = null;
  var defaultValue;
  var self = this;
  var columnDataBundle = null;

  self.keyCaptureList = [Slick.keyCode.UP, Slick.keyCode.DOWN, Slick.keyCode.ENTER];

  self.OnIndexChangeEvent = function () {
    $input.focus();
  };

@AlexandrChazov
Copy link
Contributor Author

AlexandrChazov commented Apr 2, 2024

Yes, @6pac is absolutely right. All the key codes like

Slick.keyCode.UP, Slick.keyCode.DOWN, Slick.keyCode.ENTER
or
import { keyCode } from "slickgrid";
keyCode.UP, keyCode.DOWN, keyCode.ENTER

are numbers and checks like

if (this.currentEditor.keyCaptureList.indexOf(e.which) > -1)

will always return false and traversing up and down a dropdown list will be captured by default Slickgrid hotkeys listeners

@AlexandrChazov
Copy link
Contributor Author

AlexandrChazov commented Apr 2, 2024

@ghiscoding I've added the description.

@ghiscoding ghiscoding merged commit fbbff04 into 6pac:master Apr 2, 2024
2 checks passed
@ghiscoding
Copy link
Collaborator

thanks

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

Successfully merging this pull request may close these issues.

None yet

3 participants