{"id":20461052,"url":"https://github.com/ericgj/data-table","last_synced_at":"2025-03-05T11:27:38.633Z","repository":{"id":8543217,"uuid":"10164034","full_name":"ericgj/data-table","owner":"ericgj","description":"Minimalist data table view","archived":false,"fork":false,"pushed_at":"2013-06-27T20:13:14.000Z","size":152,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-16T00:35:52.888Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/ericgj.png","metadata":{"files":{"readme":"Readme.md","changelog":"History.md","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":"2013-05-20T01:37:14.000Z","updated_at":"2014-09-01T02:30:46.000Z","dependencies_parsed_at":"2022-09-17T03:01:10.037Z","dependency_job_id":null,"html_url":"https://github.com/ericgj/data-table","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericgj%2Fdata-table","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericgj%2Fdata-table/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericgj%2Fdata-table/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericgj%2Fdata-table/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ericgj","download_url":"https://codeload.github.com/ericgj/data-table/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242017456,"owners_count":20058432,"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":[],"created_at":"2024-11-15T12:23:01.649Z","updated_at":"2025-03-05T11:27:38.606Z","avatar_url":"https://github.com/ericgj.png","language":"JavaScript","readme":"\n# data-table\n\n  Minimalist data table view\n\n  Encapsulates rendering of header and records from model, and that's it.\n  Bring your own sorting, pagination, selection, etc. Header and record \n  templates can be bound to [reactive][reactive] views.\n\n## Installation\n\n    $ component install ericgj/data-table\n\n## Examples\n\n### Simple rendering\n\n```javascript\nvar table = DataTable('#table', model)\n              .header(headerTemplate)\n              .record(recordTemplate);\n```\n\nNote that the passed templates are _precompiled template functions_, using\nwhatever template engine you wish.\n\n### Rendering (reactive) views\n\n```javascript\nvar table = DataTable('#table', model)\n              .header(headerTemplate, headerView)\n              .record(recordTemplate, recordView);\n```\n\nNote here the passed templates are _strings_, which are DOMified and passed \ninto the view constructors together with the models. \n\nYour views are responsible for doing the binding, which can use reactive or\nsome other library.\n\n## More details:\n\n- For simple rendering, `header()` and `record()` take compiled templates.\nFor the header template, `model` and `record` (the first record) are exposed.\nFor the record template, `model`, `record`, and `index` are exposed for each\nrecord in the data.\n\n- For reactive templates, `header()` and `record()` each take a _string_ template,\nand the class of the view that binds the model to the template.\n\n- For either simple or reactive rendering, the header and records are both \nattached to the element passed in the constructor by default, or you can specify\nan element as the third parameter of `header()` and `record()`. Useful in cases\nsuch as classic tables where `\u003cthead\u003e` is a separate branch from `\u003ctbody\u003e`. Also\nuseful if you want to re-render records but not the header.\n\nFor more examples of use see `test/index.html`.\n\n## API\n\n### DataTable( el, [modelClass] )\n\nConstruct data table at el (element or string), with optional model class specified.\nNote the model class is not used generally, it's there in case your templates need it.\n\n### DataTable#header( tmpl, [view, el] )\n\nSpecify the header template (function for simple rendering, string for reactive), and\noptional view, and optional el (element or selector string) where header is appended.\n\n### DataTable#record( tmpl, [view, el] )\n\nSpecify the record template (function or string), optional view, and optional el \n(element or selector string) where records are appended.\n\n### DataTable#render( data ) \n\nRender records from data (array of objects), and header if header doesn't exist.\n\n### DataTable#clear()\n\nClear header and records and remove any views.\n\n### DataTable#headerView\n\nView object bound to header\n\n### DataTable#recordViews\n\nArray of view objects bound to records\n\n\n## Events\n\n### 'render', n\n\nAfter records rendered. N is the number of records rendered.\n\n### 'render header'\n\nAfter header rendered.\n\n\n## License\n\n  MIT\n\n\n[reactive]: https://github.com/component/reactive\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fericgj%2Fdata-table","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fericgj%2Fdata-table","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fericgj%2Fdata-table/lists"}