1- # NgxSimpleDatatable
1+ # NgxSimpleDatatables
22
33A lightweight, high-performance Angular data table component with features like virtual scrolling, column freezing, and customizable templates.
44
5-
6-
7- ![ NgxSimpleDatatable Screenshot] ( projects/ngx-simple-datatable/assets/image.png )
5+ ![ NgxSimpleDatatables Screenshot] ( /projects/ngx-simple-datatables/assets/image.png )
86
97## Features
108
@@ -27,12 +25,12 @@ npm install ngx-simple-datatables --save
27251 . Import the module in your ` app.module.ts ` :
2826
2927``` typescript
30- import { NgxSimpleDatatableModule } from " ngx-simple-datatables" ;
28+ import { NgxSimpleDatatablesModule } from " ngx-simple-datatables" ;
3129
3230@NgModule ({
3331 imports: [
3432 // ... other imports
35- NgxSimpleDatatableModule ,
33+ NgxSimpleDatatablesModule ,
3634 ],
3735})
3836export class AppModule {}
@@ -41,13 +39,13 @@ export class AppModule {}
41392 . Use the component in your template:
4240
4341``` html
44- <ngx-simple-datatable
42+ <ngx-simple-datatables
4543 [columns] =" columns"
4644 [data] =" data"
47- [rowHeight] =" 40 "
48- [headerHeight] =" 50 "
45+ [rowHeight] =" 26 "
46+ [headerHeight] =" 26 "
4947>
50- </ngx-simple-datatable >
48+ </ngx-simple-datatables >
5149```
5250
53513 . Define your columns and data in your component:
@@ -136,7 +134,7 @@ columns: ColumnConfig[] = [
136134Use Angular templates to customize cell content:
137135
138136``` html
139- <ngx-simple-datatable [columns] =" columns" [data] =" data" >
137+ <ngx-simple-datatables [columns] =" columns" [data] =" data" >
140138 <ng-template #cellTemplate let-row =" row" let-column =" column" >
141139 <ng-container [ngSwitch] =" column.field" >
142140 <ng-container *ngSwitchCase =" 'status'" >
@@ -152,23 +150,23 @@ Use Angular templates to customize cell content:
152150 <ng-container *ngSwitchDefault > {{ row[column.field] }} </ng-container >
153151 </ng-container >
154152 </ng-template >
155- </ngx-simple-datatable >
153+ </ngx-simple-datatables >
156154```
157155
158156### Custom Header Templates
159157
160158Customize header appearance and behavior:
161159
162160``` html
163- <ngx-simple-datatable [columns] =" columns" [data] =" data" >
161+ <ngx-simple-datatables [columns] =" columns" [data] =" data" >
164162 <ng-template #headerTemplate let-column =" column" >
165163 <div class =" custom-header" >
166164 <i class =" fas fa-info-circle" [title] =" column.header" ></i >
167165 <span >{{ column.header }}</span >
168166 <i class =" fas fa-sort" *ngIf =" column.sortable" ></i >
169167 </div >
170168 </ng-template >
171- </ngx-simple-datatable >
169+ </ngx-simple-datatables >
172170```
173171
174172### Theming
@@ -230,52 +228,28 @@ Customize the table appearance using CSS custom properties:
230228
231229### Column Configuration
232230
233- | Property | Type | Description |
234- | ---------- | ---------------------------- | -------------------------------- | ---------------------- |
235- | ` field ` | ` string ` | Property name in the data object |
236- | ` header ` | ` string ` | Column header text |
237- | ` width ` | `string | number` | Column width (px or %) |
238- | ` freeze ` | `'left' | 'right'` | Freeze column position |
239- | ` sortable ` | ` boolean ` | Whether the column is sortable |
240- | ` sortFn ` | ` (a: any, b: any) => number ` | Custom sort function |
241-
242- ## Styling
243-
244- You can customize the table appearance by overriding the following CSS custom properties:
245-
246- ``` css
247- .dynamic-table-container {
248- --ngx-simple-dt-bg : #ffffff ;
249- --ngx-simple-dt-border : 1px solid #e0e0e0 ;
250- --ngx-simple-dt-border-radius : 8px ;
251- --ngx-simple-dt-box-shadow : 0 2px 8px rgba (0 , 0 , 0 , 0.1 );
252- --ngx-simple-dt-transition : all 0.2s ease-in-out ;
253- }
254-
255- .table-header {
256- --ngx-simple-dt-header-bg : #f8f9fa ;
257- --ngx-simple-dt-header-hover-bg : #e9ecef ;
258- --ngx-simple-dt-header-border : 1px solid #e0e0e0 ;
259- --ngx-simple-dt-header-text : #495057 ;
260- --ngx-simple-dt-header-height : 48px ;
261- --ngx-simple-dt-header-font-weight : 600 ;
262- --ngx-simple-dt-header-padding : 0 16px ;
263- }
264- ```
231+ | Property | Type | Description | details |
232+ | ---------- | ---------------------------- | -------------------------------- | ------------ |
233+ | ` field ` | ` string ` | Property name in the data object | string |
234+ | ` header ` | ` string ` | Column header text | string |
235+ | ` width ` | ` string \| number ` | Column width (px or %) | |
236+ | ` freeze ` | ` 'left' \| 'right' ` | Freeze column position | |
237+ | ` sortable ` | ` boolean ` | Whether the column is sortable | true / false |
238+ | ` sortFn ` | ` (a: any, b: any) => number ` | Custom sort function | function |
265239
266240## Development
267241
268- Run ` ng build ngx-simple-datatable ` to build the library. The build artifacts will be stored in the ` dist/ ` directory.
242+ Run ` ng build ngx-simple-datatables ` to build the library. The build artifacts will be stored in the ` dist/ ` directory.
269243
270244## Publishing
271245
272- After building your library with ` ng build ngx-simple-datatable ` , go to the dist folder ` cd dist/ngx-simple-datatable ` and run ` npm publish ` .
246+ After building your library with ` ng build ngx-simple-datatables ` , go to the dist folder ` cd dist/ngx-simple-datatables ` and run ` npm publish ` .
273247
274- After building your library with ` ng build ngx-simple-datatable ` , go to the dist folder ` cd dist/ngx-simple-datatable ` and run ` npm publish ` .
248+ After building your library with ` ng build ngx-simple-datatables ` , go to the dist folder ` cd dist/ngx-simple-datatables ` and run ` npm publish ` .
275249
276250## Running unit tests
277251
278- Run ` ng test ngx-simple-datatable ` to execute the unit tests via [ Karma] ( https://karma-runner.github.io ) .
252+ Run ` ng test ngx-simple-datatables ` to execute the unit tests via [ Karma] ( https://karma-runner.github.io ) .
279253
280254## Further help
281255
0 commit comments