JQuery Grid Paste Code
Brought to you by:
eruciform
File | Date | Author | Commit |
---|---|---|---|
.gitignore | 2011-08-16 |
![]() |
[d9e2f8] initial commit 1.0.0 |
README | 2011-08-16 |
![]() |
[d9e2f8] initial commit 1.0.0 |
basic.html | 2011-08-16 |
![]() |
[d9e2f8] initial commit 1.0.0 |
jquery-1.5.2.min.js | 2011-08-16 |
![]() |
[d9e2f8] initial commit 1.0.0 |
jquery-catchpaste-1.0.0.js | 2011-08-16 |
![]() |
[d9e2f8] initial commit 1.0.0 |
jquery-catchpaste-1.0.0.min.js | 2011-08-16 |
![]() |
[d9e2f8] initial commit 1.0.0 |
jquery-gridpaste.js | 2011-08-29 |
![]() |
[ef43ac] better mechanism for handling hidden cells, and... |
jquery-gridpaste.min.js | 2011-08-29 |
![]() |
[ef43ac] better mechanism for handling hidden cells, and... |
jquery.caret.1.02.min.js | 2011-08-16 |
![]() |
[d9e2f8] initial commit 1.0.0 |
JQuery Grid Paste === OVERVIEW --- This plugin captures tabular data pasted into input fields that are part of tables, and sends the data to the appropriate sibling inputs, mimicking the very basic functionality of pasting a block of cells in Excel. INSTALLATION --- * Copy jquery-gridpaste.js or any specific or minified version of jquery-gridpaste(-x.x.x)(.min).js into your javascript directory * Make sure that jquery 1.5.2 or later is somewhere accessible * Make sure that jquery-caret 1.02 or later is somewhere accessible * Make sure that jquery-catchpaste 1.0.0 or later is somewhere accessible * Load jquery-gridpaste and its dependencies: * <script src="jquery-1.5.2.min.js"></script> * <script src="jquery-caret.1.02.min.js"></script> * <script src="jquery-catchpaste-1.0.0.js"></script> * <script src="jquery-gridpaste-1.0.0.js"></script> * After that, a new $(selector).gridpaste() feature is available BASIC USAGE --- Just apply gridpaste to any inputs that you want to handle the new paste functionality. It will find the closest outer table automatically, and all the surrounding th's and td's with either inputs or textareas in them. No other tags are supported, nor are thead nor tfoot portions of tables. ~~~~~ $("table.mymagictable input").gridpaste() ~~~~~ CAVEATS --- This assumes that all tabular data is left-rectified, and that there are no empty cells on lines of their own. Think about parsing rows separated by newlines, and each of them separated by tabs. You can grab a square block of things that's missing the last item on a line or two, no problem. But if the first line "starts" on the third column, and then you paste, by the time it gets to the target to paste, there's no information left to say that it starts "on the third column for just that line". Try a few non-square chunks in the example. MORE CAVEATS --- See [JQuery CatchPaste](https://sourceforge.net/p/jqcatchpaste/wiki/Main/).