7

I've implemented handsontable in MVC .Net 4 using razer views, and although the paste functionality works beautifully on localhost (both in release and debug mode), it fails once deployed.

It fails silently (no console output) but if you double click to edit a specific cell, you can paste all the data into that cell, but it doesn't work when trying to paste a table from excel into handsontable. I've tried debugging the actual handsontable code but have found almost nothing to help out, only that it looks like the hidden textarea (class copyPaste) is not set to active when ctrl key is pressed, but I could be completely misguided about this ascertion. I don't know if this is maybe an IIS setting (I doubt it, javascript is client side) or something completely unrelated, but any help would be much appreciated. I feel like I'm going a little crazy with this one.

audiochick
  • 184
  • 1
  • 10

1 Answers1

2

I found the problem, which is deceptively simple.

In the jquery.handsontable.full.js on line 6279:

that.selectNodeText(that.elTextarea);

That line was commented out, I just uncommented it, and everything worked beautifully again.

I hope this helps someone one day if they run into the same sort of issue. Happy coding!

audiochick
  • 184
  • 1
  • 10
  • 1
    It's bizarre that this would be commented out by default since it the main reason to use the handsontable plugin. I'm still unable to get a paste to work and it appears to be a timing issue. When I put a break point in my browser debugger on the `that.selectNodeText(that.elTextarea);` line and hit play immediately after it breaks, it works. When there is no break point, it doesn't work. Any ideas? – mellis481 Jun 02 '14 at 15:22
  • Which version of handsontable are you using? I've double checked in my code base, and can't reproduce your problem.... – audiochick Jun 04 '14 at 07:13
  • Handsontable 0.10.5. jQuery 2.0.0. – mellis481 Jun 04 '14 at 16:33
  • Interesting. Apparently it does work with that line uncommented. I guess with all the `setTimeout`s, I wasn't giving it enough time. Thanks for your help! – mellis481 Jun 04 '14 at 19:24
  • 1
    Just encountered this, and for me it seems to vary with javascript minification of handsontable. If I skip minification, it works fine. Still investigating, but uncommenting that line has no effect for me. – StrayPointer Jul 16 '14 at 15:18