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 suppress navigation events in ag grid react without suppressing react events in editor component #1527

Closed
rrhvella opened this issue Mar 16, 2017 · 1 comment

Comments

@rrhvella
Copy link

I'm submitting a ... (check one with "x")

[ ] bug report => search github for a similar issue or PR before submitting
[ x] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/ceolter/ag-grid/blob/master/CONTRIBUTING.md#question

Current behavior

A similar feature request to this has already been raised #921.

However, the proposed solution (using event.stopPropagation) doesn't work with the react version of the ag grid. This is because react implements a global event handler and dispatches synthetic events to its components. facebook/react#8693

Since ag grid is not a react component and isn't driven by react events, I cannot stop propagation within a react event handler; I have to implement a dom event handler and stop propagation within it. This stops the event from reaching any react components, regardless of weather they are children or parents of the component which stops the propagation.

Expected behavior

Ideally, it should be possible to turn off navigation keys for editors through a flag on the column definition.

columnDefs: {
        {headerName: 'Col A', field: 'a', cellEditorFramework: MyReactComponent, suppressNavigationInEditMode: true }
    }

I understand that this solution is extremely coupled to the problem. However, given the way react works and the fact that ag grid is not driven through react events, I can't see another solution. I'll be implementing this in a fork, so if you want I can submit a PR.

Minimal reproduction of the problem with instructions
This plunkr shows an example of the issue http://plnkr.co/edit/Cdz9yqI7k9qgoGQc2u2a?p=preview

Stopping dom event propogation in TestEditor doesn't block the dom event in TestEditorSubComponent, but it blocks the react event from reaching that same component. Therefore there is no way for me to stop navigation keydown events from reaching Ag Grid while at the same time handling those same events within my component. Doing everything through dom events is not an option, as I can't use third party react components in that case.

  • ag-Grid version: 8.2.0

  • ag-Grid-React version: 8.2.0

  • Browser:
    Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36

  • Language: [TypeScript 2.2.1 | ES7 ]

@seanlandsman
Copy link
Member

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