{"id":21944536,"url":"https://github.com/torrobinson/jquery-editable-table","last_synced_at":"2025-04-22T21:05:50.787Z","repository":{"id":47161753,"uuid":"362483523","full_name":"torrobinson/jquery-editable-table","owner":"torrobinson","description":"✏️ A small jQuery extension to turn a static HTML table into an editable one. For quickly populating a small table with JSON data, letting the user modify it with validation, and then getting JSON data back out.","archived":false,"fork":false,"pushed_at":"2022-12-28T01:56:41.000Z","size":68,"stargazers_count":14,"open_issues_count":7,"forks_count":6,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-22T21:05:44.370Z","etag":null,"topics":["editable","editable-grid","editable-table","jquery","table"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/torrobinson.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-04-28T13:47:26.000Z","updated_at":"2025-04-17T07:45:58.000Z","dependencies_parsed_at":"2023-01-31T05:46:09.313Z","dependency_job_id":null,"html_url":"https://github.com/torrobinson/jquery-editable-table","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/torrobinson%2Fjquery-editable-table","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/torrobinson%2Fjquery-editable-table/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/torrobinson%2Fjquery-editable-table/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/torrobinson%2Fjquery-editable-table/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/torrobinson","download_url":"https://codeload.github.com/torrobinson/jquery-editable-table/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250324692,"owners_count":21411946,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["editable","editable-grid","editable-table","jquery","table"],"created_at":"2024-11-29T04:16:34.854Z","updated_at":"2025-04-22T21:05:50.753Z","avatar_url":"https://github.com/torrobinson.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# jquery-editable-table\nA small jQuery extension to turn an HTML table editable for fast data entry and validation\n\n# Demo\n👉 https://jsfiddle.net/torrobinson/63z182vL/ 👈\n\u003cbr/\u003e\u003cbr/\u003e\n---\n\u003cbr/\u003e\u003cbr/\u003e\n\n# Config\n```\n{\n columns: [], // required\n actions: []  // optional\n}\n```\n\n## columns\n| Option             | Type                        | Description                                                                                                                                          |\n|--------------------|-----------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------|\n| index              | int                         | The index of the column in the physical table                                                                                                        |\n| isHidden              | bool                         | Whether or not to hide the column from being seen/edited                                                                                                       |\n| name               | string                        | The name of the attribute bound to this column                                                                                                       |\n| maxLength               | int                        | The max length allowed to input                                                                                                       |\n| classes            | array                       | An array of CSS classes to assign to this column's cells                                                                                             |\n| convertOut         | function(internalValue)     | A function to take an internal value (most likely a string) to format or cast it when the value is being extracted with `getData()`                  |\n| isValid            | function(newValue, allData) | A function to validate a new valid being added. Function provides all table data to compare against.                                                 |\n| afterChange        | function(newValue, cell)    | A function that is executed after a cell value is changed (and validated). It provides the new value, as well as the physical table cell holding it. |\n| removeRowIfCleared | bool                        | If true, when this cell value is cleared for a row, the entire row will be removed.                                                                  |\n\n## actions\n| Option             | Type                        | Description                                                                                                                                          |\n|--------------------|-----------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------|\n| label              | string                         | HTML for the button or icon for this action                                                                                                |\n| action              | function(clickEventArgs, row)         | The action to perform when the button/icon is clicked                                                             \n\n---\n\u003cbr/\u003e\u003cbr/\u003e\n\n# Functions\n| Function | Parameters   | Description                                           |\n|----------|--------------|-------------------------------------------------------|\n| getData  | ()           | Returns all table data (array)                        |\n| setData  | (data array) | Accepts data (array) and sets the table to this state |\n| addRow   | (newRow)     | Accepts an object and adds to the end of table data   |\n| clear    | ()           | Clears all data from the table                        |\n\n# Example...\n```html\n \u003ctable id=\"sample-table\"\u003e\n   \u003cthead\u003e\n     \u003ctr\u003e\n       \u003cth\u003eUnique Id\u003c/th\u003e\n       \u003cth\u003eNumber\u003c/th\u003e\n     \u003c/tr\u003e\n   \u003c/thead\u003e\n   \u003ctbody\u003e\n   \u003c/tbody\u003e\n\u003c/table\u003e\n```\n\n```js\n$('#sample-table').editableTable({\n    columns: [\n        // Example of a field that must be unique\n        {\n            index: 0,\n            name: 'id',\n            removeRowIfCleared: true,\n            isValid: (newVal, data) =\u003e {\n                // Ensure the id number is unique\n                let allIds = data.map(p =\u003e p.id);\n                return !allIds.includes(newVal);\n            }\n        },\n        // Example of a number that is validated as an int\n        {\n            index: 1,\n            name: 'number',\n            classes: ['text-end'],\n            isValid: (val) =\u003e {\n                val = parseInt(val);\n                return !isNaN(val) \u0026\u0026 Number.isInteger(val);\n            }\n        }\n    ],\n    actions: [\n    \t{\n      \tlabel: '\u003cbutton\u003eDelete\u003c/button\u003e',\n        action: (e, row) =\u003e {\n        \t // Remove the row from the table\n          row.remove();\n        }\n      },\n    ]\n});\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftorrobinson%2Fjquery-editable-table","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftorrobinson%2Fjquery-editable-table","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftorrobinson%2Fjquery-editable-table/lists"}