jQuery Online Spreadsheet Editing Plugin
Add-ons

Plugin Description: A jQuery online spreadsheet editing plugin that supports dynamic columns and rows, as well as input fields, dropdown lists, radio buttons, checkboxes, and more.
Last Updated: 2020-12-15 22:12:18
Changelog:Added a border when hovering the mouse over an item.
Last Updated: 2020-12-14 00:13:20
Changelog:Fixed the radio button selection issue after adding a new row.
Last Updated: 2020-12-11 00:33:22
Usage
Add container:
1 | <div id="table" class="full"> |
Add JavaScript:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | var selectOptions = [{ k: '', v: 'Please select' }, { k: 'java', v: 'Java Development' }, { k: 'python', v: 'Python Development' }, { k: 'rs', v: 'Human Resources' },];var list = [{ username: 'Zhang San', age: 24, birth: '1996-06-07', job: 'java', job2: 'java', place: 'Wuhan', love: '1,3' }, { username: 'Yang Wei', age: 28, birth: '1992-06-07', job: 'python', job2: 'java', place: 'Wuhan', love: '1', sex: '2' }....];var obj = $("#table").initExcelTable({ // Whether to display column headers showHeader: true, columns: [{ // Configure the table header header: { text: "Name", css: { 'font-weight': 'bold' } }, // Set column names fieldName: 'username', // Set cell types. Currently supports input, select, checkbox, and radio type: "input", width: 200, emptyText: "Please enter a name...", cellStyle: { align: 'center', }, css: { background: '#cff' } }, { header: { text: "Age", css: { 'font-weight': 'bold', background: '#9fe' } }, fieldName: 'age', type: "input", width: 200, emptyText: "Enter a number...", readonly: true, cellStyle: { align: 'right', }, css: { background: '#0cf' } }... ], // Initialize the number of rows row: 4});// Set table dataobj.setData(list);$("#tableBtn").click(function() { var data = obj.getData(); $("#data").val(JSON.stringify(data, null, 2));}) |
评论