ngx-deebodata 0.5.1 → 0.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # NgxDeebodata
2
2
 
3
- Angular v22 data grid with virtual scroll, integrated charts, row grouping, column resizing, column hiding, cell editing, tab accessibility, sorting with priority, and advanced filtering. This package uses only basic @angular packages and rxjs as peer dependencies.
3
+ Angular v22 data grid with virtual scroll or pagination, integrated charts, row grouping, column resizing, column hiding, cell editing, tab accessibility, sorting with priority, and advanced filtering. This package uses only basic @angular packages and rxjs as peer dependencies.
4
4
 
5
5
  # Demos
6
6
 
@@ -43,6 +43,7 @@ export class App {
43
43
  ```
44
44
  <ngx-deebodata
45
45
  [editable]="true"
46
+ [paginate]="false"
46
47
  [rowNumbers]="true"
47
48
  [data]="sampleData()"
48
49
  [color1]="'navy'"
@@ -65,6 +66,10 @@ export class App {
65
66
  | Input | Type | Default | Description
66
67
  |----------|----------|----------|----------|
67
68
  | `editable` | `boolean` | `true` | Allows cells to be edited |
69
+ | `paginate` | `boolean` | `false` | Paginate data. Defaults to in memory |
70
+ | `serverSideTotal` | `number` | `0` | Activate server side pagination with a value > 0 |
71
+ | `pageLoadMessage` | `string` | `Loading...` | Message to display while you're executing ss pagination |
72
+ | `rowsPerPage` | `number` | `25` | Number of rows per page if paginated=true, max is 250 |
68
73
  | `rowNumbers` | `boolean` | `true` | Show row numbers on left hand side of grid |
69
74
  | `data` | `signal<any[]>` | `[]` | signal Array of objects to display |
70
75
  | `color1` | `string` | `""` | Theme color 1 (css, hex, rgb) |
@@ -85,6 +90,7 @@ export class App {
85
90
  | Output | Type | Description
86
91
  |----------|----------|----------|
87
92
  | `cellEdit` | `CellEdit` | An object that emits with all necessary cell edit details. See more details further down |
93
+ | `pageChange` | `PageChange` | An object that emits on paginator change events if serverSideTotal input bound property is > 0. Facilitates server side pagination |
88
94
  -
89
95
 
90
96
 
@@ -92,6 +98,9 @@ It's best to pass hex or rgb colors to **color1, color2, pieGraphColors, & altRo
92
98
 
93
99
  Always pass a **px** string value to defRowHgt like '50px'
94
100
 
101
+ Charts and Dropdown filters are disabled when server-side pagination is enabled or when paginate=true AND serverSideTotal > 0;
102
+ Row grouping, Row numbers, and Dropdown filters are disabled when paginate=true. Charts and filters are limited to the data currently in memory when using server side pagination
103
+
95
104
  **forceGrouping** - if a column you want grouping/dropdown filters for isn't getting that treatment automatically, try to force it with this - may or may not work
96
105
  depending on how many distinct values the column has and other criteria
97
106
 
@@ -144,12 +153,41 @@ handleCellEdit(event: CellEdit) {//executes on cell edit if editable isn't false
144
153
  }
145
154
  ```
146
155
 
156
+ **To Implement Server-side Pagination**
157
+
158
+ - In the .ts component you want to use the data grid in
159
+
160
+ ```
161
+ import { PageChange, NgxDeebodata } from 'ngx-deebodata';
162
+ ```
163
+
164
+ - in the exported class
165
+
166
+ ```
167
+ handlePageChange(event: PageChange) {//executes on paginator change if serverSideTotal > 0
168
+ //implement a server side http request using the data emitted here and update the data input with your resulting response array of data.
169
+ //You can update the serverSideTotal here also for instance if you're using filters and want a new total from your backend based on said filters
170
+ Keep the serverSideTotal > rowsPerPage even on failed or no result api responses so that this function gets invoked!!
171
+ /*PageChange interface -> { skip: number; take: number; columnConfig?: any; topLevelFilter: string; sortOrder: string[]; }
172
+ skip will be the page number selected - 1. So selecting page 1 will emit a skip equal to 0 for your custom logic
173
+ take will be equal to the rowsPerPage value you can update
174
+ topLevelFilter is the value of the omnifilter input above the data grid
175
+ columnConfig contains the filter values on a per column basis and an 'asc' or 'desc' value for any sorted columns
176
+ sortOrder is a string[] with a list of column names in order of sort priority, if any sorts are applied*/
177
+ // console.log(event)
178
+ //charts and filters are limited to the data currently in memory when using server side pagination
179
+ }
180
+ ```
181
+
147
182
  - In the template of the component
148
183
 
149
184
  ```
150
185
  <ngx-deebodata
151
- [data]="sampleData()"
152
- (cellEdit)="handleCellEdit($event)"
186
+ [pagination]="true"
187
+ [serverSideTotal]="1000000"
188
+ [pageLoadMessage]="'Loading...'"
189
+ [data]="someServerPaginatedData()"
190
+ (pageChange)="handlePageChange($event)"
153
191
  ></ngx-deebodata>
154
192
  ```
155
193