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

Option to disable auto-edit for new row #445

Closed
kienerj opened this issue Oct 15, 2019 · 2 comments · Fixed by #855
Closed

Option to disable auto-edit for new row #445

kienerj opened this issue Oct 15, 2019 · 2 comments · Fixed by #855
Labels

Comments

@kienerj
Copy link

kienerj commented Oct 15, 2019

It seems that for the new row, auto-edit is enabled by default and can't be turned off (unless I'm missing something). this can be seen in slick.grid.js on line 4777 in function setActiveCellInternal:

if (opt_editMode == null) {
    opt_editMode = (activeRow == getDataLength()) || options.autoEdit;
} 

This is called when navigating to a cell either by click or by keys and in that case opt_editMode is passed into the function as null.

This causes a problem with the cellexternalcopymanager. I want to paste one or more new rows but that doesn't work if the editor for that cell is automatically enabled on entering the cell.

This can be easily seen in the example. Pasting only new rows into first unnamed column works, because that column has no editor assigned. Pasting into other columns with an editor doesn't work because the editor blocks the pasting.

If I comment above code, then it also works for cells with an editor assigned with the downside that triple-click is needed to activate the cursor in the editor. This also isn't ideal (and I'm not sure why triple-click is needed) but my suggestion is to add an option to disable auto-edit on new rows (and allow the edit with a double-click, not sure how).

if (opt_editMode == null && options.autoEditNewRow) { opt_editMode = (activeRow == getDataLength()) || options.autoEdit; }

This would make a ton of sense as pasting usually is new data to be appended and not updates to existing data.

@6pac
Copy link
Owner

6pac commented Oct 16, 2019

Good points. I think we need a more nuanced way than a setting, I'll look into this. The plugin should be able to ignore whatever setting exists and just insert the rows regardless.

ghiscoding added a commit that referenced this issue Oct 1, 2023
- fixes #445
- when using CellExternalCopyManager and user wants to paste cell selection range, it could be useful to not automatically open the cell that was clicked even if it has an editor defined
ghiscoding added a commit that referenced this issue Oct 3, 2023
… (#855)

- fixes #445
- when using CellExternalCopyManager and user wants to paste cell selection range, it could be useful to not automatically open the cell that was clicked even if it has an editor defined
@ghiscoding
Copy link
Collaborator

better late than never, now available in latest version 5.1.0, I decided to go with the proposed code change because I don't think there are better ways that I can think of to determine if we should use the cell editor or not, so I think this proposition was ok and I also kept the proposed name as well autoEditNewRow

Lastly please note that a lot changed since this issue was created, we dropped jQuery/jQueryUI and we migrated to TypeScript

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

Successfully merging a pull request may close this issue.

3 participants