How can I copy excel style table cells using jQuery?

has a nice feature that allows these cells to be copied with the mouse and dragged. The same functionality is offered by the Google spreadsheet.

I cannot understand the Googles JavaScript code and figure out how they did it. Is this functionality what the jQuery framework provides?

I would be grateful for any information: keywords / jQuery functions / plugin, pseudocode, link, etc.

+4
source share
1 answer

I have never done such a thing or did not know any plugins, but I have some ideas.

  • First of all, to copy something to the clipboard, you need a combination of javascript and flash (for combinations ctrl + c ctrl + v)
  • To drag cells, I would do it like this. Draw a lot of rectangles for the screen. Using the jQuery mousedown and mouseup events, first calculate the moving coordinates of the rectangle, and then select all the rectangles between the two. If the mouse is at the edges of these selected boxes, change the mouse icon. At mousedown, start pulling. Then, when mouseup, find the new rectangle, calculate the other rectangles based on the number of source ones, then replace them.
0
source

Source: https://habr.com/ru/post/1346714/


All Articles