-
Notifications
You must be signed in to change notification settings - Fork 9
paste outside existing grid boundaries #48
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
Comments
Couple things we could do here. I think I like the idea of adding paste events the most since it doesn't make assumptions and doesn't force you to throw UI code in the data layer. Auto-Create DescriptorsProvide an option on the AbstractRowColModel to auto-create new descriptors on paste. To make this work we'd either need a grid.rowModel.enableAutoCreateDescriptors = function (options: Callback | DefaultDescriptorOptions) {
...
} Add a
|
ya I dig the event api the most. tbh you could just capture the paste event as a work around that doesn't require changes.
|
hey look at that. this does in fact work for what I need I can hack around it for now (ish) but ideally we should do the paste pre-processing (parsing/excel format transform/etc.) and then make the parsed data available through an api somewhere. |
totally.
…On Thu, 23 Aug 2018 at 10:33 Joe Chrzanowski ***@***.***> wrote:
Couple things we could do here. I think I like the idea of adding paste
events the most since it doesn't make assumptions and doesn't force you to
throw UI code in the data layer.
Auto-Create Descriptors
Provide an option on the AbstractRowColModel to auto-create new
descriptors on paste. To make this work we'd either need a
defaultDescriptorOptions or a callback to configure the descriptor.
grid.rowModel.enableAutoCreateDescriptors = function (options: Callback | DefaultDescriptorOptions) {
...
}
Add a setOutOfBounds method to the DataModel
Basically throws the responsibility of handling out-of-bounds data to
whoever provides the data model. I think I like this one the most since you
get pretty granular control over how out-of-bounds data is handled, but I
don't know if modifying the col/row descriptors in a data model function
would cause issues. Also feels weird to be modifying the grid structure
from the data model
{
...,
setOutOfBounds: (row: number, col: number, value: any) {
if (row > this.rowModel.length()) {
grid.rowModel.add(newRowDescriptor)
}
// forward to the original set function dataModel.set(row, col, value)
}
Improve Copy/Paste API
Provide grid events for beforePaste (and I guess afterPaste for symmetry)
with information about paste coordinates and pasted data size. Adjust the
descriptors for the grid in beforePaste
—
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub
<#48 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ABE5mHPWC_PKMXbCj4ZqluU9ZB-EM8R7ks5uTudsgaJpZM4WIlYk>
.
|
We're dealing with a use case where the grid columns are fixed (the "schema") but a user can add/remove/update any of the rows. One of the use-cases we want this to handle is the situation where someone kept a list of data in a spreadsheet somewhere and they want to paste it into the grid.
As is, it looks like the paste command doesn't allow pasting outside the col/row descriptor boundaries:
https://github.com/gridgrid/grid/blob/next/src/modules/copy-paste/index.ts#L167
Wanted to start an issue to discuss the best way to handle this and/or implement a way for additional row/column descriptors to be created on-demand in response to a paste event.
The text was updated successfully, but these errors were encountered: