Dmitry Yun
Dmitry Yun

Reputation: 5

w2ui multi cells pasting

I have w2ui grid with inline editing. For example we can take demo: http://w2ui.com/web/demos/#!grid/grid-21

I want to copy/paste some data from Excel file. I can successfully copy/paste one single cell value. BUT I need to copy/paste several cells. For example I choose A1:A3 Excel cells and want to paste values to existing records in w2ui grid. I tried to select first column and press Ctrl+V, but it pastes all three values to one grid column.

Question: Is is possible to make multi cells copy/paste?

Upvotes: 0

Views: 968

Answers (1)

Mike Scotty
Mike Scotty

Reputation: 10782

This already works in w2ui 1.5 (master), and should also work in w2ui 1.5 rc1.

I created a fiddle based on http://w2ui.com/web/demos/#!combo/combo-3

The only difference is that I call save() when the paste event finishes, so that new values are visible immediately.

Fiddle: http://jsfiddle.net/2exmrkyv/

Just make sure the you have set selectType: 'cell' on the grid.

I tested it successfully with copy & paste from w2grid to w2grid and also with Excel 2013 to w2grid (single value, multiple values and selections across multiple rows / columns).

Internally, w2grid will split lines (rows) by \n and values (columns) by \t. If your Excel exports data differently to the clipboard you'll have to change it (though I don't know where and if it's possible).

If everything else fails, your last restort is to override w2grid.paste and implement it yourself.

Upvotes: 0

Related Questions