{"id":13500755,"url":"https://github.com/micc83/editTable","last_synced_at":"2025-03-29T07:31:35.432Z","repository":{"id":12585414,"uuid":"15256144","full_name":"micc83/editTable","owner":"micc83","description":"jQuery editTable is a very small jQuery Plugin (~1Kb gzipped) that fill the gap left by the missing of a default input field for data tables.","archived":false,"fork":false,"pushed_at":"2021-04-26T15:27:33.000Z","size":36,"stargazers_count":161,"open_issues_count":2,"forks_count":57,"subscribers_count":21,"default_branch":"master","last_synced_at":"2025-03-20T10:58:36.789Z","etag":null,"topics":["datatable","jquery-edittable","jquery-plugin","textarea"],"latest_commit_sha":null,"homepage":"https://micc83.github.io/editTable/demo/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/micc83.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-12-17T14:12:46.000Z","updated_at":"2025-03-15T20:58:54.000Z","dependencies_parsed_at":"2022-08-27T02:54:07.512Z","dependency_job_id":null,"html_url":"https://github.com/micc83/editTable","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/micc83%2FeditTable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/micc83%2FeditTable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/micc83%2FeditTable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/micc83%2FeditTable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/micc83","download_url":"https://codeload.github.com/micc83/editTable/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246155994,"owners_count":20732355,"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":["datatable","jquery-edittable","jquery-plugin","textarea"],"created_at":"2024-07-31T22:01:13.002Z","updated_at":"2025-03-29T07:31:35.151Z","avatar_url":"https://github.com/micc83.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"jQuery editTable\n=========\n\njQuery editTable is a very small jQuery Plugin (~1Kb gzipped) that fill the gap left by the missing of a default \u003cstrong\u003einput field for data tables\u003c/strong\u003e. jQuery editTable can be used both in ajax and/or HTTP POST contest and let you preset the title and number of columns or just let complete freedom to the user. You can even append custom behaviors to single column cells (ex. \u003cstrong\u003ejQuery UI Datepicker\u003c/strong\u003e). The only limit is your imagination! :)\n\nTo use it you just have to include jQuery and a copy of the plugin in your head or footer:\n\n```html\n\u003cscript type=\"text/javascript\" src=\"http://code.jquery.com/jquery-latest.js\"\u003e\u003c/script\u003e\n\u003cscript type=\"text/javascript\" src=\"jquery.edittable.min.js\"\u003e\u003c/script\u003e\n\u003clink rel=\"stylesheet\" href=\"jquery.edittable.min.css\"\u003e\n```\n\nNow you can trigger editTable on any textarea or block element (ex. div, article, section ...). In case you trigger it on a textarea, its content will be used as JSON source for the table. If the textarea is inside a form, on submit, its content will be updated with the new JSON data. Otherwise, if you trigger it on a block element the table will be appended to the element itself (ajax).\n\n```js\nvar mytable = $('#edittable').editTable({\n    data: [['']],           // Fill the table with a js array (this is overridden by the textarea content if not empty)\n    tableClass: 'inputtable',   // Table class, for styling\n    jsonData: false,        // Fill the table with json data (this will override data property)\n    headerCols: false,      // Fix columns number and names (array of column names)\n    maxRows: 999,           // Max number of rows which can be added\n    first_row: true,        // First row should be highlighted?\n    row_template: false,    // An array of column types set in field_templates\n    field_templates: false, // An array of custom field type objects\n\n    // Validate fields\n    validate_field: function (col_id, value, col_type, $element) {\n        return true;\n    }\n});\n```\n\nThere are of course many methods which can be used on the created table. Let's see...\n\n```js\nmytable.loadData(dataArray);    // Fill the table with js data\nmytable.loadJsonData(jsonData); // Fill the table with JSON data\nmytable.getData();              // Get a js array of the table data\nmytable.getJsonData();          // Get JSON from the table data\nmytable.reset();                // Reset the table to the initial set of data\nmytable.isValidated()           // Check if the table pass validation set with validate_field\n```\n\nTo define a \u003cstrong\u003ecustom field type\u003c/strong\u003e object:\n\n```js\n[\n    'checkbox' : {\n\n        html: '\u003cinput type=\"checkbox\"\u003e',     // Input type html\n\n        // How to get the value from the custom input\n        getValue: function (input) {\n            return $(input).is(':checked');\n        },\n\n        // How to set the value of the custom input\n        setValue: function (input, value) {\n            if ( value ){\n                return $(input).attr('checked', true);\n            }\n            return $(input).removeAttr('checked');\n        }\n    }\n]\n```\n\nThat's it, now give a look to [the examples](https://micc83.github.io/editTable/demo/) to understand how it works.\n\n## Credits and contacts\n\nReStable has been made by [me](https://github.com/micc83). You can contact me at micc83@gmail.com or [twitter](https://twitter.com/Micc1983) for any issue or feauture request.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicc83%2FeditTable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmicc83%2FeditTable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicc83%2FeditTable/lists"}