{"id":28683660,"url":"https://github.com/Trixwell/data-grid","last_synced_at":"2025-06-14T03:03:49.730Z","repository":{"id":292394236,"uuid":"961032641","full_name":"Trixwell/data-grid","owner":"Trixwell","description":null,"archived":false,"fork":false,"pushed_at":"2025-06-04T13:44:48.000Z","size":157,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-04T20:26:57.151Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/Trixwell.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-04-05T15:56:27.000Z","updated_at":"2025-06-04T13:44:50.000Z","dependencies_parsed_at":"2025-06-04T14:44:00.044Z","dependency_job_id":"6c01ee58-9b2f-41bb-87f6-f7e034d455ea","html_url":"https://github.com/Trixwell/data-grid","commit_stats":null,"previous_names":["trixwell/data-grid"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/Trixwell/data-grid","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Trixwell%2Fdata-grid","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Trixwell%2Fdata-grid/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Trixwell%2Fdata-grid/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Trixwell%2Fdata-grid/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Trixwell","download_url":"https://codeload.github.com/Trixwell/data-grid/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Trixwell%2Fdata-grid/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259752029,"owners_count":22905968,"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":"2025-06-14T03:01:10.445Z","updated_at":"2025-06-14T03:03:49.722Z","avatar_url":"https://github.com/Trixwell.png","language":"TypeScript","readme":"# NgxDataGrid\n\n## Overview\n\n**NgxDataGridx** is a Angular component that renders data in a highly customizable and interactive data table. It supports features such as filtering, sorting, pagination, CSV export, expandable sub-grids, and integration with Angular Material components.\n\n---\n\n## Installation\n\nTo use `NgxDataGridx`, ensure you have Angular and Angular Material installed. Then, import the component into your module:\n\n📦 NPM Package:\nhttps://www.npmjs.com/package/@trixwell/ngx-data-gridx\n\n```bash\nnpm install ngx-data-gridx\n```\n\n### Required peer dependencies:\n\n```bash\nnpm install @angular/material @angular/forms @angular/common rxjs\n```\n\n**In your `app.module.ts`:**\n\n```ts\nimport { NgxDataGridx } from 'ngx-data-gridx';\n\n@NgModule({\n  declarations: [AppComponent],\n  imports: [NgxDataGridx],\n  bootstrap: [AppComponent],\n})\nexport class AppModule {}\n```\n\n---\n\n## Inputs (`@Input`)\n\n| Name                 | Type                                          | Description                                            |\n| -------------------- | --------------------------------------------- |--------------------------------------------------------|\n| `url`                | `string`                                      | API endpoint to load data from.                        |\n| `exportCsvUrl`       | `string`                                      | URL to export the current filtered data in CSV format. |\n| `data`               | `GridProperty[]`                              | Configuration for grid columns.                        |\n| `limit`              | `number`                                      | Number of rows per page.                               |\n| `sort`               | `string`                                      | Sort direction: `asc` or `desc`.                       |\n| `sidx`               | `string`                                      | Field name to sort by.                                 |\n| `grid_name`          | `string`                                      | Unique identifier for the grid.                        |\n| `multiselect`        | `boolean`                                     | Enables row multi-selection.                           |\n| `showFilters`        | `boolean`                                     | Toggle filter visibility.                              |\n| `subUrlParams`       | `{ paramName: string; columnName: string }[]` | Parameters to pass to sub-grid requests.               |\n| `currentRow`         | `object`                                      | Parent row context for sub-grid data.                  |\n| `showHistoryFilters` | `boolean`                                     | Display history of applied filters.                    |\n| `expandedElement`    | `object`                                      | Row currently expanded to show sub-grid.               |\n| `noDataPlaceholder`  | `string`                                      | Message to display when no data is found.              |\n| `parentGridFilters`  | `object`                                      | Filters from a parent grid to apply in a sub-grid context. |\n\n---\n\n## Key Methods\n\n* `loadData(page, limit)` — Fetches data from `url` with filters, sorting, and pagination applied.\n* `onFilterChange(column, type, label, value)` — Applies a filter to a column.\n* `onDateRangeChange(column, formGroup)` — Applies date range filtering.\n* `clearAllFilters()` — Resets all applied filters.\n* `exportCsvAction()` — Initiates export of filtered data to CSV.\n* `setCurrentGridColumn(column, row)` — Toggles sub-grid view for a row.\n\n---\n\n## Template Structure\n\n* **Filter Controls**: Positioned above the table; supports input search, select, checkbox, and date-range.\n* **Table Body**: Built with `\u003cmat-table\u003e`. Each column is defined using `matColumnDef`. Rows are populated using `MatTableDataSource`.\n* **Expandable Rows**: Sub-grids can be rendered by expanding a row.\n* **Actions**: Built-in buttons for filtering, clearing, and exporting.\n\nUses Angular Material components: `mat-table`, `mat-paginator`, `mat-form-field`, `mat-select`, `mat-checkbox`, `mat-icon`, `mat-progress-bar`, `mat-date-range-input`, etc.\n\n---\n\n## Animations \u0026 Interactions\n\n* **Row Expansion**: Smooth expansion/collapse using Angular animations (`@detailExpand`).\n* **Filtering**: Debounced reactive search using `Subject` + `debounceTime` for responsive UX.\n* **Multi-select**: Row selection via `mat-checkbox`.\n* **CSV Export**: Filtered results can be exported with one click.\n\n---\n\n## Example Usage\n\n### Component Setup\n\n```ts\n@Component({\n  selector: 'app-root',\n  templateUrl: './app.component.html',\n})\nexport class AppComponent {\n  apiUrl = '/api/items';\n  columnConfig: GridProperty[] = [\n    new GridProperty({\n      name: 'id',\n      displayName: 'ID',\n      type: GridPropertyType.Number,\n      sort: true,\n    }),\n    new GridProperty({\n      name: 'title',\n      displayName: 'Title',\n      type: GridPropertyType.Text,\n      search: true,\n    }),\n    new GridProperty({\n      name: 'category',\n      displayName: 'Category',\n      type: GridPropertyType.Text,\n      filter: [\n        { label: 'Category', type: 'select' },\n      ],\n      filterValues: [[\n        { label: 'Books', value: 'books' },\n        { label: 'Music', value: 'music' },\n      ]],\n    }),\n    new GridProperty({\n      name: 'created_at',\n      displayName: 'Created',\n      type: GridPropertyType.Date,\n      filter: [\n        { label: 'Date range', type: 'date' },\n      ]\n    }),\n    new GridProperty({\n      name: 'details',\n      displayName: 'Details',\n      type: GridPropertyType.Text,\n      ident: true,\n      subGridSettings: new SubGridSettings({\n        suburl: '/api/items/details',\n        subUrlParams: [{ paramName: 'item_id', columnName: 'id' }],\n        subGridProps: {\n          multiselect: false,\n          limit: 5,\n          search: true,\n          showFilters: true\n        }\n      }),\n      subGridPropertyList: [\n        new GridProperty({\n          name: 'detail_id',\n          displayName: 'Detail ID',\n          type: GridPropertyType.Number\n        }),\n        new GridProperty({\n          name: 'description',\n          displayName: 'Description',\n          type: GridPropertyType.Text\n        })\n      ]\n    })\n  ];\n}\n```\n\n### Template\n\n```html\n\u003cngx-data-gridx\n  [url]=\"apiUrl\"\n  [data]=\"columnConfig\"\n  [limit]=\"10\"\n  sidx=\"created_at\"\n  sort=\"desc\"\n  [multiselect]=\"true\"\n  [showFilters]=\"true\"\n  grid_name=\"ExampleGrid\"\u003e\n\u003c/ngx-data-gridx\u003e\n```\n\n---\n","funding_links":[],"categories":["Third Party Components"],"sub_categories":["Data Grids"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FTrixwell%2Fdata-grid","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FTrixwell%2Fdata-grid","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FTrixwell%2Fdata-grid/lists"}