ngx-deebodata 0.5.2 → 0.5.4

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
 
@@ -66,7 +66,9 @@ export class App {
66
66
  | Input | Type | Default | Description
67
67
  |----------|----------|----------|----------|
68
68
  | `editable` | `boolean` | `true` | Allows cells to be edited |
69
- | `paginate` | `boolean` | `false` | Paginate data in memory |
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 |
70
72
  | `rowsPerPage` | `number` | `25` | Number of rows per page if paginated=true, max is 250 |
71
73
  | `rowNumbers` | `boolean` | `true` | Show row numbers on left hand side of grid |
72
74
  | `data` | `signal<any[]>` | `[]` | signal Array of objects to display |
@@ -88,6 +90,7 @@ export class App {
88
90
  | Output | Type | Description
89
91
  |----------|----------|----------|
90
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 |
91
94
  -
92
95
 
93
96
 
@@ -95,7 +98,8 @@ It's best to pass hex or rgb colors to **color1, color2, pieGraphColors, & altRo
95
98
 
96
99
  Always pass a **px** string value to defRowHgt like '50px'
97
100
 
98
- Row grouping and Row numbers are disabled when paginate=true
101
+ Charts, Dropdown filters, Row grouping, and Row numbers are disabled when server-side pagination is enabled or when paginate=true AND serverSideTotal > 0;
102
+ Row grouping and Row numbers are disabled when paginate=true but no serverSideTotal is set (in memory pagination).
99
103
 
100
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
101
105
  depending on how many distinct values the column has and other criteria
@@ -149,12 +153,41 @@ handleCellEdit(event: CellEdit) {//executes on cell edit if editable isn't false
149
153
  }
150
154
  ```
151
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
+
152
182
  - In the template of the component
153
183
 
154
184
  ```
155
185
  <ngx-deebodata
156
- [data]="sampleData()"
157
- (cellEdit)="handleCellEdit($event)"
186
+ [pagination]="true"
187
+ [serverSideTotal]="1000000"
188
+ [pageLoadMessage]="'Loading...'"
189
+ [data]="someServerPaginatedData()"
190
+ (pageChange)="handlePageChange($event)"
158
191
  ></ngx-deebodata>
159
192
  ```
160
193