Currently there is no copy/paste option in this module for importing and this would be a must have feat. in my opinion.
So we can go and easily select some table in word or excel or just internet and copy content of it, create grid with this module and paste values, this would be great, any prospects on this?

Issue fork tablefield-1677596

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

kevin hankens’s picture

That is a great idea. I don't have time to do it personally, but I'd love to see a patch. Perhaps there could be an #ajax form similar to the rebuild button where it would take a csv-type of string and rebuild the tablefield widget with those values.

sylvaticus’s picture

Issue summary: View changes

Hello, I would be interested as well.... unfortunatly my users are likely to have no idea on what a csv file is, but they may be able to do a copy/paste ;-)

lunazoid’s picture

Had an instance where the ability to paste the table data would make for a better experience for my client, so I threw together a quick patch to allow it. The column separator defaults to the TAB character (since this is what data copied from a spreadsheet will have) but can be changed to any other character.

In hindsight, maybe this functionality should be a separate module and use a hook_form_alter...

lunazoid’s picture

Version: 7.x-2.0-beta6 » 7.x-2.x-dev
jenlampton’s picture

Status: Active » Needs review
StatusFileSize
new7.05 KB

I really like this feature, it's something my editors will appreciate. I've taken a stab at re-working the patch. There's a little general cleanup in here, but the only significant change is that I removed the "Other" textfield for the delimiter option, since I'd guess the main use-cases here are for tab and comma.

jenlampton’s picture

Status: Needs review » Needs work

I've been using this patch in production and I found a few gotchas with the table not being resized correctly after paste. Ive got a fixed up version and will supply a new patch shortly. Marking as NW for now.

jenlampton’s picture

Status: Needs work » Needs review
StatusFileSize
new7.6 KB

This one pastes data and resizes the tablefield appropriately.

  • jenlampton committed 8b6379c on 7.x-2.x
    Issue #1677596 by lunazoid: add an option to copy/paste data into a text...
jenlampton’s picture

Status: Needs review » Fixed

Thanks so much @lunazoid! this feature will be in the next release of tablefield :)

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

lolandese’s picture

Version: 7.x-2.x-dev » 8.x-2.x-dev
Status: Closed (fixed) » Patch (to be ported)
Parent issue: » #2189203: D8 port (from the existing 7.x-3.x to a new 8.x-3.x)
matthieu_collet’s picture

hello

I'm interested in this functionnality on Drupal 8 version of tablefield, is there any planning on it ?
is somebody working on it ?

it's too complex to make it myself :(

thank you

davidiio’s picture

StatusFileSize
new11.73 KB

Hi,

We needed this to work with D8 so I made the following changes in tablefield based on patch #7.
It would be nice if someone could revie this patch because it works for what I tried to achieve but I am not sure it is every use case proof.

Thanks

lolandese’s picture

Status: Patch (to be ported) » Needs review
lolandese’s picture

Status: Needs review » Needs work

Patch fails to apply. Try creating it with git diff.

martin@martin-XPS-13-9370 /var/www/html/brown.localhost/web/modules/tablefield (8.x-2.x=) $ git apply -v tablefield-copy-paste-d8.patch
error: unrecognized input

Also at https://dispatcher.drupalci.org/job/drupal8_contrib_patches/19694/console:

23:16:40 Applying patch /var/lib/drupalci/workspace/jenkins-drupal8_contrib_patches-19694/ancillary/tablefield-copy-paste-d8.patch to /var/lib/drupalci/workspace/jenkins-drupal8_contrib_patches-19694/source/modules/contrib/tablefield
23:16:40 fatal: unrecognized input
23:16:40 Patch Error
23:16:40 The patch attempt returned an error.  Error code: 128
23:16:40 Patch Failed to Apply
23:16:40 fatal: unrecognized input
matthieu_collet’s picture

the test I added was an error, it worked, i don't know how to remove it

davidiio created it with git diff

douggreen’s picture

Status: Needs work » Needs review
StatusFileSize
new6.02 KB

Updated patch mostly just fixes the diff so it applies cleanly, but also adjust some minor coding standards.

Munavijayalakshmi’s picture

Assigned: Unassigned » Munavijayalakshmi

i am working in this issue.

Munavijayalakshmi’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new49.22 KB
new46.68 KB
new68.84 KB
Munavijayalakshmi’s picture

Assigned: Munavijayalakshmi » Unassigned
erutan’s picture

#17 applies cleanly to 2.4 and works great.

While manual entry would work for very small bits of info, and having the file uploads is great for more complex use cases, in ours we need to add in data produced by another program - copy and pasting is a lot simpler than generating a file and then attaching it. I'd recommend this get patched in. :)

erutan’s picture

StatusFileSize
new6.02 KB

Fix formatting in patch on permissions.yml to match earlier code cleanup so it applies to dev, applied to fork.

erutan’s picture

Assigned: Unassigned » erutan
Status: Reviewed & tested by the community » Needs work

Tests give the following new errors:

Drupal.Commenting.FunctionComment.ParamMissingDefinition at /builds/project/tablefield/web/modules/custom/tablefield/src/Element/Tablefield.php (485:3)
Drupal.Commenting.FunctionComment.ParamNameNoMatch at /builds/project/tablefield/web/modules/custom/tablefield/src/Element/Tablefield.php (488:6)

  • erutan committed 0414748f on 8.x-2.x
    Resolve #1677596 "Copy paste option"
    
erutan’s picture

Status: Needs work » Fixed

Params were copy-pasted from elsewhere in the document before.

liam morland’s picture

Should this be cherry-picked onto branch 3.0.x?

erutan’s picture

It's new functionality, but it's just an extra option on top of existing ones (and is very useful). It should be in both branches.

  • liam morland committed 749ecbd0 on 3.0.x
    Issue #1677596: Correct spelling error
    
    Fixes issue introduced in...

  • liam morland committed 9ad77efb on 8.x-2.x
    Issue #1677596: Correct spelling error
    
    Fixes issue introduced in...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.