@exhaustive-ui/mcp 22.4.0 → 22.6.0
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 +13 -1
- package/data/cards/accordion.md +91 -0
- package/data/cards/animateonscroll.md +155 -0
- package/data/cards/autocomplete.md +109 -0
- package/data/cards/autofocus.md +36 -0
- package/data/cards/avatar.md +45 -0
- package/data/cards/badge.md +44 -0
- package/data/cards/blockui.md +51 -0
- package/data/cards/breadcrumb.md +56 -0
- package/data/cards/button.md +83 -0
- package/data/cards/card.md +49 -0
- package/data/cards/carousel.md +101 -0
- package/data/cards/cascadeselect.md +77 -0
- package/data/cards/chart.md +105 -0
- package/data/cards/checkbox.md +59 -0
- package/data/cards/chip.md +50 -0
- package/data/cards/classnames.md +91 -0
- package/data/cards/colorpicker.md +52 -0
- package/data/cards/confirmdialog.md +119 -0
- package/data/cards/confirmpopup.md +96 -0
- package/data/cards/contextmenu.md +60 -0
- package/data/cards/dataview.md +134 -0
- package/data/cards/datepicker.md +103 -0
- package/data/cards/dialog.md +89 -0
- package/data/cards/divider.md +55 -0
- package/data/cards/dock.md +106 -0
- package/data/cards/dragdrop.md +106 -0
- package/data/cards/drawer.md +62 -0
- package/data/cards/dynamicdialog.md +103 -0
- package/data/cards/editor.md +55 -0
- package/data/cards/fieldset.md +54 -0
- package/data/cards/fileinput.md +72 -0
- package/data/cards/fileupload.md +88 -0
- package/data/cards/floatlabel.md +41 -0
- package/data/cards/fluid.md +49 -0
- package/data/cards/focustrap.md +64 -0
- package/data/cards/galleria.md +94 -0
- package/data/cards/iconfield.md +45 -0
- package/data/cards/iftalabel.md +38 -0
- package/data/cards/image.md +58 -0
- package/data/cards/imagecompare.md +45 -0
- package/data/cards/inplace.md +56 -0
- package/data/cards/inputgroup.md +77 -0
- package/data/cards/inputmask.md +71 -0
- package/data/cards/inputnumber.md +78 -0
- package/data/cards/inputotp.md +60 -0
- package/data/cards/inputtext.md +41 -0
- package/data/cards/keyfilter.md +49 -0
- package/data/cards/knob.md +55 -0
- package/data/cards/listbox.md +105 -0
- package/data/cards/megamenu.md +96 -0
- package/data/cards/menu.md +64 -0
- package/data/cards/menubar.md +102 -0
- package/data/cards/message.md +51 -0
- package/data/cards/metergroup.md +53 -0
- package/data/cards/multiselect.md +115 -0
- package/data/cards/orderlist.md +96 -0
- package/data/cards/organizationchart.md +84 -0
- package/data/cards/overlay.md +63 -0
- package/data/cards/paginator.md +62 -0
- package/data/cards/panel.md +57 -0
- package/data/cards/panelmenu.md +94 -0
- package/data/cards/password.md +81 -0
- package/data/cards/picklist.md +106 -0
- package/data/cards/popover.md +53 -0
- package/data/cards/progressbar.md +42 -0
- package/data/cards/progressspinner.md +38 -0
- package/data/cards/radiobutton.md +52 -0
- package/data/cards/rating.md +56 -0
- package/data/cards/ripple.md +37 -0
- package/data/cards/scroller.md +32 -0
- package/data/cards/scrollpanel.md +50 -0
- package/data/cards/scrolltop.md +48 -0
- package/data/cards/select.md +108 -0
- package/data/cards/selectbutton.md +64 -0
- package/data/cards/skeleton.md +54 -0
- package/data/cards/slider.md +52 -0
- package/data/cards/speeddial.md +102 -0
- package/data/cards/splitbutton.md +96 -0
- package/data/cards/splitter.md +52 -0
- package/data/cards/stepper.md +125 -0
- package/data/cards/styleclass.md +46 -0
- package/data/cards/table.md +305 -0
- package/data/cards/tabs.md +97 -0
- package/data/cards/tag.md +41 -0
- package/data/cards/terminal.md +76 -0
- package/data/cards/textarea.md +45 -0
- package/data/cards/tieredmenu.md +121 -0
- package/data/cards/timeline.md +58 -0
- package/data/cards/toast.md +58 -0
- package/data/cards/togglebutton.md +59 -0
- package/data/cards/toggleswitch.md +52 -0
- package/data/cards/toolbar.md +74 -0
- package/data/cards/tooltip.md +43 -0
- package/data/cards/tree.md +93 -0
- package/data/cards/treeselect.md +98 -0
- package/data/cards/treetable.md +231 -0
- package/data/components/accordion.md +31 -23
- package/data/components/animateonscroll.md +18 -15
- package/data/components/autocomplete.md +162 -93
- package/data/components/autofocus.md +9 -7
- package/data/components/avatar.md +56 -43
- package/data/components/badge.md +27 -18
- package/data/components/blockui.md +15 -8
- package/data/components/breadcrumb.md +20 -14
- package/data/components/button.md +121 -94
- package/data/components/card.md +12 -10
- package/data/components/carousel.md +75 -53
- package/data/components/cascadeselect.md +271 -238
- package/data/components/chart.md +88 -74
- package/data/components/checkbox.md +107 -97
- package/data/components/chip.md +20 -16
- package/data/components/classnames.md +22 -4
- package/data/components/colorpicker.md +54 -36
- package/data/components/confirmdialog.md +146 -43
- package/data/components/confirmpopup.md +95 -22
- package/data/components/contextmenu.md +110 -39
- package/data/components/dataview.md +176 -83
- package/data/components/datepicker.md +171 -141
- package/data/components/dialog.md +80 -68
- package/data/components/divider.md +17 -12
- package/data/components/dock.md +65 -29
- package/data/components/dragdrop.md +26 -12
- package/data/components/drawer.md +67 -48
- package/data/components/dynamicdialog.md +22 -13
- package/data/components/editor.md +42 -33
- package/data/components/fieldset.md +20 -17
- package/data/components/fileinput.md +92 -35
- package/data/components/fileupload.md +101 -61
- package/data/components/floatlabel.md +20 -11
- package/data/components/fluid.md +11 -9
- package/data/components/focustrap.md +11 -7
- package/data/components/galleria.md +231 -90
- package/data/components/iconfield.md +23 -15
- package/data/components/iftalabel.md +15 -9
- package/data/components/image.md +31 -26
- package/data/components/imagecompare.md +8 -6
- package/data/components/inplace.md +27 -22
- package/data/components/inputgroup.md +53 -29
- package/data/components/inputmask.md +107 -85
- package/data/components/inputnumber.md +128 -90
- package/data/components/inputotp.md +55 -42
- package/data/components/inputtext.md +72 -50
- package/data/components/keyfilter.md +6 -3
- package/data/components/knob.md +70 -58
- package/data/components/listbox.md +171 -141
- package/data/components/llms.md +4 -0
- package/data/components/megamenu.md +24 -23
- package/data/components/menu.md +37 -34
- package/data/components/menubar.md +27 -22
- package/data/components/message.md +44 -32
- package/data/components/metergroup.md +48 -17
- package/data/components/multiselect.md +232 -168
- package/data/components/orderlist.md +55 -48
- package/data/components/organizationchart.md +182 -13
- package/data/components/overlay.md +31 -26
- package/data/components/paginator.md +49 -34
- package/data/components/panel.md +23 -19
- package/data/components/panelmenu.md +51 -25
- package/data/components/password.md +104 -91
- package/data/components/picklist.md +93 -71
- package/data/components/popover.md +68 -46
- package/data/components/progressbar.md +28 -22
- package/data/components/progressspinner.md +13 -11
- package/data/components/radiobutton.md +69 -35
- package/data/components/rating.md +48 -40
- package/data/components/ripple.md +8 -6
- package/data/components/scroller.md +29 -29
- package/data/components/scrollpanel.md +9 -7
- package/data/components/scrolltop.md +20 -18
- package/data/components/select.md +248 -169
- package/data/components/selectbutton.md +118 -56
- package/data/components/skeleton.md +22 -18
- package/data/components/slider.md +73 -49
- package/data/components/speeddial.md +77 -59
- package/data/components/splitbutton.md +354 -329
- package/data/components/splitter.md +22 -18
- package/data/components/stepper.md +38 -21
- package/data/components/styleclass.md +12 -6
- package/data/components/table.md +524 -315
- package/data/components/tabs.md +44 -26
- package/data/components/tag.md +18 -14
- package/data/components/terminal.md +38 -27
- package/data/components/textarea.md +82 -47
- package/data/components/tieredmenu.md +34 -29
- package/data/components/timeline.md +29 -28
- package/data/components/toast.md +115 -57
- package/data/components/togglebutton.md +53 -39
- package/data/components/toggleswitch.md +41 -28
- package/data/components/toolbar.md +19 -18
- package/data/components/tooltip.md +43 -32
- package/data/components/tree.md +114 -81
- package/data/components/treeselect.md +176 -174
- package/data/components/treetable.md +1250 -1045
- package/data/components.json +4134 -4088
- package/data/llms-full.txt +8979 -6437
- package/data/llms.txt +100 -96
- package/data/manifest.json +183 -15
- package/data/pages/llms.md +29 -0
- package/data/pages/tailwind.md +20 -10
- package/data/snapshot.json +2 -2
- package/dist/index.d.mts +37 -2
- package/dist/index.mjs +1395 -1079
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/data/components/table.md
CHANGED
|
@@ -4,17 +4,17 @@ Table displays data in tabular format.
|
|
|
4
4
|
|
|
5
5
|
## Accessibility
|
|
6
6
|
|
|
7
|
-
Screen Reader Default role of the table is table . Header, body and footer elements use rowgroup , rows use row role, header cells have columnheader and body cells use cell roles. Sortable headers utilizer aria-sort attribute either set to "ascending" or "descending". Table rows and table cells should be specified by users using the aria-posinset , aria-setsize , aria-label , and aria-describedby attributes, as they are determined through templating. Built-in checkbox and radiobutton components for row selection use checkbox and radiobutton . The label to describe them is retrieved from the aria.selectRow and aria.unselectRow properties of the locale API. Similarly header checkbox uses selectAll and unselectAll keys. When a row is selected, aria-selected is set to true on a row. The element to expand or collapse a row is a button with aria-expanded and aria-controls properties. Value to describe the buttons is derived from aria.expandRow and aria.collapseRow properties of the locale API. The filter menu button use aria.showFilterMenu and aria.hideFilterMenu properties as aria-label in addition to the aria-haspopup , aria-expanded and aria-controls to define the relation between the button and the overlay. Popop menu has dialog role with aria-modal as focus is kept within the overlay. The operator dropdown use aria.filterOperator and filter constraints dropdown use aria.filterConstraint properties. Buttons to add rules on the other hand utilize aria.addRule and aria.removeRule properties. The footer buttons similarly use aria.clear and aria.apply properties.
|
|
7
|
+
Screen Reader Default role of the table is table . Header, body and footer elements use rowgroup , rows use row role, header cells have columnheader and body cells use cell roles. Sortable headers utilizer aria-sort attribute either set to "ascending" or "descending". Table rows and table cells should be specified by users using the aria-posinset , aria-setsize , aria-label , and aria-describedby attributes, as they are determined through templating. Built-in checkbox and radiobutton components for row selection use checkbox and radiobutton . The label to describe them is retrieved from the aria.selectRow and aria.unselectRow properties of the locale API. Similarly header checkbox uses selectAll and unselectAll keys. When a row is selected, aria-selected is set to true on a row. The element to expand or collapse a row is a button with aria-expanded and aria-controls properties. Value to describe the buttons is derived from aria.expandRow and aria.collapseRow properties of the locale API. The filter menu button use aria.showFilterMenu and aria.hideFilterMenu properties as aria-label in addition to the aria-haspopup , aria-expanded and aria-controls to define the relation between the button and the overlay. Popop menu has dialog role with aria-modal as focus is kept within the overlay. The operator dropdown use aria.filterOperator and filter constraints dropdown use aria.filterConstraint properties. Buttons to add rules on the other hand utilize aria.addRule and aria.removeRule properties. The footer buttons similarly use aria.clear and aria.apply properties. ariaLabel of the ColumnFilter component can be used to define the aria label of the built-in filter element, if a custom component is used with templating you also may define your own aria labels as well. Editable cells use custom templating so you need to manage aria roles and attributes manually if required. The row editor controls are button elements with aria.editRow , aria.cancelEdit and aria.saveEdit used for the aria-label . When a caption is defined, the table element refers to it with aria-labelledby so that screen readers announce it as the name of the table. Paginator is a standalone component used inside the Table, refer to the paginator for more information about the accessibility features. Keyboard Support Any button element inside the Table used for cases like filter, row expansion, edit are tabbable and can be used with space and enter keys. Sortable Headers Keyboard Support Key Function tab Moves through the headers. enter Sorts the column. space Sorts the column. Filter Menu Keyboard Support Key Function tab Moves through the elements inside the popup. escape Hides the popup. enter Opens the popup. Selection Keyboard Support Key Function tab Moves focus to the first selected row, if there is none then first row receives the focus. up arrow Moves focus to the previous row. down arrow Moves focus to the next row. enter Toggles the selected state of the focused row depending on the metaKeySelection setting. space Toggles the selected state of the focused row depending on the metaKeySelection setting. home Moves focus to the first row. end Moves focus to the last row. shift + down arrow Moves focus to the next row and toggles the selection state. shift + up arrow Moves focus to the previous row and toggles the selection state. shift + space Selects the rows between the most recently selected row and the focused row. control + shift + home Selects the focused rows and all the options up to the first one. control + shift + end Selects the focused rows and all the options down to the last one. control + a Selects all rows. Reorder Keyboard Support Key Function control + left arrow Moves the focused reorderable column one place towards the start (towards the end in right-to-left layouts). control + right arrow Moves the focused reorderable column one place towards the end (towards the start in right-to-left layouts). control + up arrow Moves the row of the focused reorder handle one place up. control + down arrow Moves the row of the focused reorder handle one place down. On macOS, command can be used instead of control . Rows can also be reordered with a touch or a pen on the reorder handle. After a move with the keyboard, a polite live region announces the new position, using the aria.columnMoved and aria.rowMoved properties of the locale API, where {{ '{' }}position{{ '}' }} and {{ '{' }}total{{ '}' }} are replaced by the numbers.
|
|
8
8
|
|
|
9
9
|
## Basic
|
|
10
10
|
|
|
11
11
|
DataTable requires a collection to display along with column components for the representation of the data.
|
|
12
12
|
|
|
13
13
|
```typescript
|
|
14
|
-
import { Component,
|
|
15
|
-
import {
|
|
16
|
-
import { ProductService } from '@/service/productservice';
|
|
14
|
+
import { Component, inject, OnInit } from '@angular/core';
|
|
15
|
+
import { TableModule } from '@exhaustive-ui/core/table';
|
|
17
16
|
import { Product } from '@/domain/product';
|
|
17
|
+
import { ProductService } from '@/service/productservice';
|
|
18
18
|
|
|
19
19
|
@Component({
|
|
20
20
|
template: `
|
|
@@ -45,6 +45,7 @@ import { Product } from '@/domain/product';
|
|
|
45
45
|
})
|
|
46
46
|
export class TableBasicDemo implements OnInit {
|
|
47
47
|
private productService = inject(ProductService);
|
|
48
|
+
|
|
48
49
|
products!: Product[];
|
|
49
50
|
|
|
50
51
|
ngOnInit() {
|
|
@@ -60,12 +61,13 @@ export class TableBasicDemo implements OnInit {
|
|
|
60
61
|
In-cell editing is enabled by adding pEditableColumn directive to an editable cell that has a p-cell-editor helper component to define the input-output templates for the edit and view modes respectively.
|
|
61
62
|
|
|
62
63
|
```typescript
|
|
63
|
-
import {
|
|
64
|
+
import { CommonModule } from '@angular/common';
|
|
65
|
+
import { Component, inject, OnInit } from '@angular/core';
|
|
64
66
|
import { FormsModule } from '@angular/forms';
|
|
65
|
-
import { TableModule } from '@exhaustive-ui/core/table';
|
|
66
67
|
import { InputTextModule } from '@exhaustive-ui/core/inputtext';
|
|
67
|
-
import {
|
|
68
|
+
import { TableModule } from '@exhaustive-ui/core/table';
|
|
68
69
|
import { Product } from '@/domain/product';
|
|
70
|
+
import { ProductService } from '@/service/productservice';
|
|
69
71
|
|
|
70
72
|
@Component({
|
|
71
73
|
template: `
|
|
@@ -127,11 +129,12 @@ import { Product } from '@/domain/product';
|
|
|
127
129
|
</div>
|
|
128
130
|
`,
|
|
129
131
|
standalone: true,
|
|
130
|
-
imports: [TableModule, InputTextModule
|
|
132
|
+
imports: [CommonModule, FormsModule, TableModule, InputTextModule],
|
|
131
133
|
providers: [ProductService]
|
|
132
134
|
})
|
|
133
135
|
export class TableCelleditDemo implements OnInit {
|
|
134
136
|
private productService = inject(ProductService);
|
|
137
|
+
|
|
135
138
|
products!: Product[];
|
|
136
139
|
|
|
137
140
|
ngOnInit() {
|
|
@@ -147,10 +150,12 @@ export class TableCelleditDemo implements OnInit {
|
|
|
147
150
|
Multiple selection can also be handled using checkboxes by enabling the selectionMode property of column as multiple .
|
|
148
151
|
|
|
149
152
|
```typescript
|
|
150
|
-
import {
|
|
153
|
+
import { CommonModule } from '@angular/common';
|
|
154
|
+
import { Component, inject, OnInit } from '@angular/core';
|
|
155
|
+
import { FormsModule } from '@angular/forms';
|
|
151
156
|
import { TableModule } from '@exhaustive-ui/core/table';
|
|
152
|
-
import { ProductService } from '@/service/productservice';
|
|
153
157
|
import { Product } from '@/domain/product';
|
|
158
|
+
import { ProductService } from '@/service/productservice';
|
|
154
159
|
|
|
155
160
|
@Component({
|
|
156
161
|
template: `
|
|
@@ -182,12 +187,14 @@ import { Product } from '@/domain/product';
|
|
|
182
187
|
</div>
|
|
183
188
|
`,
|
|
184
189
|
standalone: true,
|
|
185
|
-
imports: [TableModule],
|
|
190
|
+
imports: [CommonModule, FormsModule, TableModule],
|
|
186
191
|
providers: [ProductService]
|
|
187
192
|
})
|
|
188
193
|
export class TableCheckboxselectionDemo implements OnInit {
|
|
189
194
|
private productService = inject(ProductService);
|
|
195
|
+
|
|
190
196
|
products!: Product[];
|
|
197
|
+
|
|
191
198
|
selectedProducts!: Product;
|
|
192
199
|
|
|
193
200
|
ngOnInit() {
|
|
@@ -204,8 +211,8 @@ Columns can be grouped using rowspan and colspan properties.
|
|
|
204
211
|
|
|
205
212
|
```typescript
|
|
206
213
|
import { Component, OnInit } from '@angular/core';
|
|
214
|
+
import { CommonModule } from '@angular/common';
|
|
207
215
|
import { TableModule } from '@exhaustive-ui/core/table';
|
|
208
|
-
import { Product } from '@/domain/product';
|
|
209
216
|
|
|
210
217
|
@Component({
|
|
211
218
|
template: `
|
|
@@ -247,13 +254,33 @@ import { Product } from '@/domain/product';
|
|
|
247
254
|
</div>
|
|
248
255
|
`,
|
|
249
256
|
standalone: true,
|
|
250
|
-
imports: [TableModule]
|
|
257
|
+
imports: [CommonModule, TableModule]
|
|
251
258
|
})
|
|
252
259
|
export class TableColumngroupDemo implements OnInit {
|
|
253
260
|
sales!: any[];
|
|
261
|
+
|
|
254
262
|
lastYearTotal!: number;
|
|
263
|
+
|
|
255
264
|
thisYearTotal!: number;
|
|
256
265
|
|
|
266
|
+
calculateLastYearTotal() {
|
|
267
|
+
let total = 0;
|
|
268
|
+
for (let sale of this.sales) {
|
|
269
|
+
total += sale.lastYearProfit;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
this.lastYearTotal = total;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
calculateThisYearTotal() {
|
|
276
|
+
let total = 0;
|
|
277
|
+
for (let sale of this.sales) {
|
|
278
|
+
total += sale.thisYearProfit;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
this.thisYearTotal = total;
|
|
282
|
+
}
|
|
283
|
+
|
|
257
284
|
ngOnInit() {
|
|
258
285
|
this.sales = [
|
|
259
286
|
{
|
|
@@ -321,17 +348,10 @@ export class TableColumngroupDemo implements OnInit {
|
|
|
321
348
|
thisYearProfit: 12533
|
|
322
349
|
}
|
|
323
350
|
];
|
|
351
|
+
|
|
324
352
|
this.calculateLastYearTotal();
|
|
325
353
|
this.calculateThisYearTotal();
|
|
326
|
-
}
|
|
327
354
|
|
|
328
|
-
calculateThisYearTotal() {
|
|
329
|
-
let total = 0;
|
|
330
|
-
for (let sale of this.sales) {
|
|
331
|
-
total += sale.thisYearProfit;
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
this.thisYearTotal = total;
|
|
335
355
|
}
|
|
336
356
|
}
|
|
337
357
|
```
|
|
@@ -341,10 +361,11 @@ export class TableColumngroupDemo implements OnInit {
|
|
|
341
361
|
Setting columnResizeMode as expand changes the table width as well.
|
|
342
362
|
|
|
343
363
|
```typescript
|
|
344
|
-
import {
|
|
364
|
+
import { CommonModule } from '@angular/common';
|
|
365
|
+
import { Component, inject, OnInit } from '@angular/core';
|
|
345
366
|
import { TableModule } from '@exhaustive-ui/core/table';
|
|
346
|
-
import { ProductService } from '@/service/productservice';
|
|
347
367
|
import { Product } from '@/domain/product';
|
|
368
|
+
import { ProductService } from '@/service/productservice';
|
|
348
369
|
|
|
349
370
|
@Component({
|
|
350
371
|
template: `
|
|
@@ -370,11 +391,12 @@ import { Product } from '@/domain/product';
|
|
|
370
391
|
</div>
|
|
371
392
|
`,
|
|
372
393
|
standalone: true,
|
|
373
|
-
imports: [TableModule],
|
|
394
|
+
imports: [CommonModule, TableModule],
|
|
374
395
|
providers: [ProductService]
|
|
375
396
|
})
|
|
376
397
|
export class TableColumnresizeexpandmodeDemo implements OnInit {
|
|
377
398
|
private productService = inject(ProductService);
|
|
399
|
+
|
|
378
400
|
products!: Product[];
|
|
379
401
|
|
|
380
402
|
ngOnInit() {
|
|
@@ -390,10 +412,11 @@ export class TableColumnresizeexpandmodeDemo implements OnInit {
|
|
|
390
412
|
Columns can be resized using drag drop by setting the resizableColumns to true . Fit mode is the default one and the overall table width does not change when a column is resized.
|
|
391
413
|
|
|
392
414
|
```typescript
|
|
393
|
-
import {
|
|
415
|
+
import { CommonModule } from '@angular/common';
|
|
416
|
+
import { Component, inject, OnInit } from '@angular/core';
|
|
394
417
|
import { TableModule } from '@exhaustive-ui/core/table';
|
|
395
|
-
import { ProductService } from '@/service/productservice';
|
|
396
418
|
import { Product } from '@/domain/product';
|
|
419
|
+
import { ProductService } from '@/service/productservice';
|
|
397
420
|
|
|
398
421
|
@Component({
|
|
399
422
|
template: `
|
|
@@ -419,11 +442,12 @@ import { Product } from '@/domain/product';
|
|
|
419
442
|
</div>
|
|
420
443
|
`,
|
|
421
444
|
standalone: true,
|
|
422
|
-
imports: [TableModule],
|
|
445
|
+
imports: [CommonModule, TableModule],
|
|
423
446
|
providers: [ProductService]
|
|
424
447
|
})
|
|
425
448
|
export class TableColumnresizefitmodeDemo implements OnInit {
|
|
426
449
|
private productService = inject(ProductService);
|
|
450
|
+
|
|
427
451
|
products!: Product[];
|
|
428
452
|
|
|
429
453
|
ngOnInit() {
|
|
@@ -437,10 +461,11 @@ export class TableColumnresizefitmodeDemo implements OnInit {
|
|
|
437
461
|
## columnresizescrollablemode-doc
|
|
438
462
|
|
|
439
463
|
```typescript
|
|
440
|
-
import {
|
|
464
|
+
import { CommonModule } from '@angular/common';
|
|
465
|
+
import { Component, inject, OnInit } from '@angular/core';
|
|
441
466
|
import { TableModule } from '@exhaustive-ui/core/table';
|
|
467
|
+
import { Customer } from '@/domain/customer';
|
|
442
468
|
import { CustomerService } from '@/service/customerservice';
|
|
443
|
-
import { Customer, Representative, Country } from '@/domain/customer';
|
|
444
469
|
|
|
445
470
|
@Component({
|
|
446
471
|
template: `
|
|
@@ -466,11 +491,12 @@ import { Customer, Representative, Country } from '@/domain/customer';
|
|
|
466
491
|
</div>
|
|
467
492
|
`,
|
|
468
493
|
standalone: true,
|
|
469
|
-
imports: [TableModule],
|
|
494
|
+
imports: [CommonModule, TableModule],
|
|
470
495
|
providers: [CustomerService]
|
|
471
496
|
})
|
|
472
497
|
export class TableColumnresizescrollablemodeDemo implements OnInit {
|
|
473
498
|
private customerService = inject(CustomerService);
|
|
499
|
+
|
|
474
500
|
customers!: Customer[];
|
|
475
501
|
|
|
476
502
|
ngOnInit() {
|
|
@@ -486,13 +512,14 @@ export class TableColumnresizescrollablemodeDemo implements OnInit {
|
|
|
486
512
|
Row selection with an element inside a column is implemented with templating.
|
|
487
513
|
|
|
488
514
|
```typescript
|
|
489
|
-
import {
|
|
515
|
+
import { CommonModule } from '@angular/common';
|
|
516
|
+
import { Component, inject, OnInit } from '@angular/core';
|
|
517
|
+
import { MessageService } from '@exhaustive-ui/core/api';
|
|
490
518
|
import { ButtonModule } from '@exhaustive-ui/core/button';
|
|
491
519
|
import { TableModule } from '@exhaustive-ui/core/table';
|
|
492
520
|
import { ToastModule } from '@exhaustive-ui/core/toast';
|
|
493
|
-
import { ProductService } from '@/service/productservice';
|
|
494
|
-
import { MessageService } from '@exhaustive-ui/core/api';
|
|
495
521
|
import { Product } from '@/domain/product';
|
|
522
|
+
import { ProductService } from '@/service/productservice';
|
|
496
523
|
|
|
497
524
|
@Component({
|
|
498
525
|
template: `
|
|
@@ -523,14 +550,14 @@ import { Product } from '@/domain/product';
|
|
|
523
550
|
</div>
|
|
524
551
|
`,
|
|
525
552
|
standalone: true,
|
|
526
|
-
imports: [
|
|
527
|
-
providers: [
|
|
553
|
+
imports: [CommonModule, TableModule, ButtonModule, ToastModule],
|
|
554
|
+
providers: [MessageService, ProductService]
|
|
528
555
|
})
|
|
529
556
|
export class TableColumnselectionDemo implements OnInit {
|
|
530
557
|
private productService = inject(ProductService);
|
|
531
558
|
private messageService = inject(MessageService);
|
|
559
|
+
|
|
532
560
|
products!: Product[];
|
|
533
|
-
selectedProduct!: Product;
|
|
534
561
|
|
|
535
562
|
ngOnInit() {
|
|
536
563
|
this.productService.getProductsMini().then((data) => {
|
|
@@ -549,12 +576,13 @@ export class TableColumnselectionDemo implements OnInit {
|
|
|
549
576
|
This demo uses a multiselect component to implement toggleable columns.
|
|
550
577
|
|
|
551
578
|
```typescript
|
|
552
|
-
import {
|
|
579
|
+
import { CommonModule } from '@angular/common';
|
|
580
|
+
import { Component, inject, OnInit } from '@angular/core';
|
|
553
581
|
import { FormsModule } from '@angular/forms';
|
|
554
582
|
import { MultiSelectModule } from '@exhaustive-ui/core/multiselect';
|
|
555
583
|
import { TableModule } from '@exhaustive-ui/core/table';
|
|
556
|
-
import { ProductService } from '@/service/productservice';
|
|
557
584
|
import { Product } from '@/domain/product';
|
|
585
|
+
import { ProductService } from '@/service/productservice';
|
|
558
586
|
|
|
559
587
|
interface Column {
|
|
560
588
|
field: string;
|
|
@@ -588,24 +616,29 @@ interface Column {
|
|
|
588
616
|
</div>
|
|
589
617
|
`,
|
|
590
618
|
standalone: true,
|
|
591
|
-
imports: [
|
|
619
|
+
imports: [CommonModule, FormsModule, TableModule, MultiSelectModule],
|
|
592
620
|
providers: [ProductService]
|
|
593
621
|
})
|
|
594
622
|
export class TableColumntoggleDemo implements OnInit {
|
|
595
623
|
private productService = inject(ProductService);
|
|
624
|
+
|
|
596
625
|
products!: Product[];
|
|
626
|
+
|
|
597
627
|
cols!: Column[];
|
|
628
|
+
|
|
598
629
|
selectedColumns!: Column[];
|
|
599
630
|
|
|
600
631
|
ngOnInit() {
|
|
601
632
|
this.productService.getProductsMini().then((data) => {
|
|
602
633
|
this.products = data;
|
|
603
634
|
});
|
|
635
|
+
|
|
604
636
|
this.cols = [
|
|
605
637
|
{ field: 'name', header: 'Name' },
|
|
606
638
|
{ field: 'category', header: 'Category' },
|
|
607
639
|
{ field: 'quantity', header: 'Quantity' }
|
|
608
640
|
];
|
|
641
|
+
|
|
609
642
|
this.selectedColumns = this.cols;
|
|
610
643
|
}
|
|
611
644
|
}
|
|
@@ -616,13 +649,14 @@ export class TableColumntoggleDemo implements OnInit {
|
|
|
616
649
|
Table has exclusive integration with contextmenu component. In order to attach a menu to a table, add pContextMenuRow directive to the rows that can be selected with context menu, define a local template variable for the menu and bind it to the contextMenu property of the table. This enables displaying the menu whenever a row is right clicked. Optional pContextMenuRowIndex property is available to access the row index. A separate contextMenuSelection property is used to get a hold of the right clicked row. For dynamic columns, setting pContextMenuRowDisabled property as true disables context menu for that particular row.
|
|
617
650
|
|
|
618
651
|
```typescript
|
|
619
|
-
import {
|
|
652
|
+
import { CommonModule } from '@angular/common';
|
|
653
|
+
import { Component, inject, OnInit } from '@angular/core';
|
|
654
|
+
import { MenuItem, MessageService } from '@exhaustive-ui/core/api';
|
|
620
655
|
import { ContextMenuModule } from '@exhaustive-ui/core/contextmenu';
|
|
621
|
-
import {
|
|
656
|
+
import { TableModule } from '@exhaustive-ui/core/table';
|
|
622
657
|
import { ToastModule } from '@exhaustive-ui/core/toast';
|
|
623
|
-
import { ProductService } from '@/service/productservice';
|
|
624
|
-
import { MenuItem, MessageService } from '@exhaustive-ui/core/api';
|
|
625
658
|
import { Product } from '@/domain/product';
|
|
659
|
+
import { ProductService } from '@/service/productservice';
|
|
626
660
|
|
|
627
661
|
@Component({
|
|
628
662
|
template: `
|
|
@@ -650,20 +684,24 @@ import { Product } from '@/domain/product';
|
|
|
650
684
|
</div>
|
|
651
685
|
`,
|
|
652
686
|
standalone: true,
|
|
653
|
-
imports: [
|
|
654
|
-
providers: [
|
|
687
|
+
imports: [CommonModule, TableModule, ContextMenuModule, ToastModule],
|
|
688
|
+
providers: [MessageService, ProductService]
|
|
655
689
|
})
|
|
656
690
|
export class TableContextmenuDemo implements OnInit {
|
|
657
691
|
private productService = inject(ProductService);
|
|
658
692
|
private messageService = inject(MessageService);
|
|
693
|
+
|
|
659
694
|
products!: Product[];
|
|
695
|
+
|
|
660
696
|
selectedProduct!: Product;
|
|
697
|
+
|
|
661
698
|
items!: MenuItem[];
|
|
662
699
|
|
|
663
700
|
ngOnInit() {
|
|
664
701
|
this.productService.getProductsMini().then((data) => {
|
|
665
702
|
this.products = data;
|
|
666
703
|
});
|
|
704
|
+
|
|
667
705
|
this.items = [
|
|
668
706
|
{ label: 'View', icon: 'pi pi-fw pi-search', command: () => this.viewProduct(this.selectedProduct) },
|
|
669
707
|
{ label: 'Delete', icon: 'pi pi-fw pi-times', command: () => this.deleteProduct(this.selectedProduct) }
|
|
@@ -687,20 +725,21 @@ export class TableContextmenuDemo implements OnInit {
|
|
|
687
725
|
DataTable with selection, pagination, filtering, sorting and templating.
|
|
688
726
|
|
|
689
727
|
```typescript
|
|
690
|
-
import {
|
|
728
|
+
import { CommonModule } from '@angular/common';
|
|
729
|
+
import { Component, inject, OnInit } from '@angular/core';
|
|
691
730
|
import { FormsModule } from '@angular/forms';
|
|
692
731
|
import { ButtonModule } from '@exhaustive-ui/core/button';
|
|
693
732
|
import { IconFieldModule } from '@exhaustive-ui/core/iconfield';
|
|
694
733
|
import { InputIconModule } from '@exhaustive-ui/core/inputicon';
|
|
734
|
+
import { InputTextModule } from '@exhaustive-ui/core/inputtext';
|
|
695
735
|
import { MultiSelectModule } from '@exhaustive-ui/core/multiselect';
|
|
696
736
|
import { ProgressBarModule } from '@exhaustive-ui/core/progressbar';
|
|
697
737
|
import { SelectModule } from '@exhaustive-ui/core/select';
|
|
698
738
|
import { SliderModule } from '@exhaustive-ui/core/slider';
|
|
699
739
|
import { Table, TableModule } from '@exhaustive-ui/core/table';
|
|
700
740
|
import { TagModule } from '@exhaustive-ui/core/tag';
|
|
701
|
-
import {
|
|
741
|
+
import { Customer, Representative } from '@/domain/customer';
|
|
702
742
|
import { CustomerService } from '@/service/customerservice';
|
|
703
|
-
import { Customer, Representative, Country } from '@/domain/customer';
|
|
704
743
|
|
|
705
744
|
@Component({
|
|
706
745
|
template: `
|
|
@@ -756,7 +795,7 @@ import { Customer, Representative, Country } from '@/domain/customer';
|
|
|
756
795
|
<p-sort-icon field="representative.name" />
|
|
757
796
|
<p-column-filter field="representative" matchMode="in" display="menu" [showMatchModes]="false" [showOperator]="false" [showAddButton]="false" class="ml-auto">
|
|
758
797
|
<ng-template #filter let-value let-filter="filterCallback">
|
|
759
|
-
<p-multi-select [filter]="false" [
|
|
798
|
+
<p-multi-select [filter]="false" [ngModel]="value" [options]="representatives" placeholder="Any" (onChange)="filter($event.value)" optionLabel="name" class="w-full">
|
|
760
799
|
<ng-template let-option #item>
|
|
761
800
|
<div class="flex items-center gap-2">
|
|
762
801
|
<img [alt]="option.label" src="https://exhaustive-ui.com/demo/avatar/{{ option.image }}" style="width: 32px" />
|
|
@@ -788,7 +827,7 @@ import { Customer, Representative, Country } from '@/domain/customer';
|
|
|
788
827
|
<p-sort-icon field="status" />
|
|
789
828
|
<p-column-filter field="status" matchMode="equals" display="menu" class="ml-auto">
|
|
790
829
|
<ng-template #filter let-value let-filter="filterCallback">
|
|
791
|
-
<p-select [
|
|
830
|
+
<p-select [ngModel]="value" [options]="statuses" (onChange)="filter($event.value)" placeholder="Any">
|
|
792
831
|
<ng-template let-option #item>
|
|
793
832
|
<p-tag [value]="option.label" [severity]="getSeverity(option.label)" />
|
|
794
833
|
</ng-template>
|
|
@@ -861,25 +900,34 @@ import { Customer, Representative, Country } from '@/domain/customer';
|
|
|
861
900
|
</div>
|
|
862
901
|
`,
|
|
863
902
|
standalone: true,
|
|
864
|
-
imports: [ButtonModule, IconFieldModule, InputIconModule,
|
|
903
|
+
imports: [CommonModule, FormsModule, TableModule, ButtonModule, IconFieldModule, InputIconModule, InputTextModule, MultiSelectModule, SelectModule, TagModule, SliderModule, ProgressBarModule],
|
|
865
904
|
providers: [CustomerService]
|
|
866
905
|
})
|
|
867
906
|
export class TableCustomersDemo implements OnInit {
|
|
868
907
|
private customerService = inject(CustomerService);
|
|
908
|
+
|
|
869
909
|
customers!: Customer[];
|
|
910
|
+
|
|
870
911
|
selectedCustomers!: Customer[];
|
|
912
|
+
|
|
871
913
|
representatives!: Representative[];
|
|
914
|
+
|
|
872
915
|
statuses!: any[];
|
|
916
|
+
|
|
873
917
|
loading: boolean = true;
|
|
918
|
+
|
|
874
919
|
activityValues: number[] = [0, 100];
|
|
920
|
+
|
|
875
921
|
searchValue: string | undefined;
|
|
876
922
|
|
|
877
923
|
ngOnInit() {
|
|
878
924
|
this.customerService.getCustomersLarge().then((customers) => {
|
|
879
925
|
this.customers = customers;
|
|
880
926
|
this.loading = false;
|
|
927
|
+
|
|
881
928
|
this.customers.forEach((customer) => (customer.date = new Date(<Date>customer.date)));
|
|
882
929
|
});
|
|
930
|
+
|
|
883
931
|
this.representatives = [
|
|
884
932
|
{ name: 'Amy Elsner', image: 'amyelsner.png' },
|
|
885
933
|
{ name: 'Anna Fali', image: 'annafali.png' },
|
|
@@ -892,6 +940,7 @@ export class TableCustomersDemo implements OnInit {
|
|
|
892
940
|
{ name: 'Stephen Shaw', image: 'stephenshaw.png' },
|
|
893
941
|
{ name: 'Xuxue Feng', image: 'xuxuefeng.png' }
|
|
894
942
|
];
|
|
943
|
+
|
|
895
944
|
this.statuses = [
|
|
896
945
|
{ label: 'Unqualified', value: 'unqualified' },
|
|
897
946
|
{ label: 'Qualified', value: 'qualified' },
|
|
@@ -911,16 +960,16 @@ export class TableCustomersDemo implements OnInit {
|
|
|
911
960
|
switch (status) {
|
|
912
961
|
case 'unqualified':
|
|
913
962
|
return 'danger';
|
|
914
|
-
|
|
963
|
+
|
|
915
964
|
case 'qualified':
|
|
916
965
|
return 'success';
|
|
917
|
-
|
|
966
|
+
|
|
918
967
|
case 'new':
|
|
919
968
|
return 'info';
|
|
920
|
-
|
|
969
|
+
|
|
921
970
|
case 'negotiation':
|
|
922
971
|
return 'warn';
|
|
923
|
-
|
|
972
|
+
|
|
924
973
|
case 'renewal':
|
|
925
974
|
return null;
|
|
926
975
|
}
|
|
@@ -933,10 +982,11 @@ export class TableCustomersDemo implements OnInit {
|
|
|
933
982
|
Columns can be defined dynamically using the *ngFor directive.
|
|
934
983
|
|
|
935
984
|
```typescript
|
|
936
|
-
import {
|
|
985
|
+
import { CommonModule } from '@angular/common';
|
|
986
|
+
import { Component, inject, OnInit } from '@angular/core';
|
|
937
987
|
import { TableModule } from '@exhaustive-ui/core/table';
|
|
938
|
-
import { ProductService } from '@/service/productservice';
|
|
939
988
|
import { Product } from '@/domain/product';
|
|
989
|
+
import { ProductService } from '@/service/productservice';
|
|
940
990
|
|
|
941
991
|
interface Column {
|
|
942
992
|
field: string;
|
|
@@ -969,18 +1019,21 @@ interface Column {
|
|
|
969
1019
|
</div>
|
|
970
1020
|
`,
|
|
971
1021
|
standalone: true,
|
|
972
|
-
imports: [TableModule],
|
|
1022
|
+
imports: [CommonModule, TableModule],
|
|
973
1023
|
providers: [ProductService]
|
|
974
1024
|
})
|
|
975
1025
|
export class TableDynamicDemo implements OnInit {
|
|
976
1026
|
private productService = inject(ProductService);
|
|
1027
|
+
|
|
977
1028
|
products!: Product[];
|
|
1029
|
+
|
|
978
1030
|
cols!: Column[];
|
|
979
1031
|
|
|
980
1032
|
ngOnInit() {
|
|
981
1033
|
this.productService.getProductsMini().then((data) => {
|
|
982
1034
|
this.products = data;
|
|
983
1035
|
});
|
|
1036
|
+
|
|
984
1037
|
this.cols = [
|
|
985
1038
|
{ field: 'code', header: 'Code' },
|
|
986
1039
|
{ field: 'name', header: 'Name' },
|
|
@@ -993,16 +1046,17 @@ export class TableDynamicDemo implements OnInit {
|
|
|
993
1046
|
|
|
994
1047
|
## expandablerowgroup-doc
|
|
995
1048
|
|
|
996
|
-
|
|
1049
|
+
In subheader based row grouping, groups can be expanded and collapsed by placing a pRowToggler in the groupheader template and rendering the rows in the expandedrow template, with dataKey set to the groupRowsBy field. State of the expansions is held in expandedRowKeys , changes are reported with the onRowExpand and onRowCollapse events.
|
|
997
1050
|
|
|
998
1051
|
```typescript
|
|
999
|
-
import {
|
|
1000
|
-
import {
|
|
1001
|
-
import { TagModule } from '@exhaustive-ui/core/tag';
|
|
1052
|
+
import { CommonModule } from '@angular/common';
|
|
1053
|
+
import { Component, inject, OnInit } from '@angular/core';
|
|
1002
1054
|
import { ButtonModule } from '@exhaustive-ui/core/button';
|
|
1003
1055
|
import { RippleModule } from '@exhaustive-ui/core/ripple';
|
|
1056
|
+
import { TableModule } from '@exhaustive-ui/core/table';
|
|
1057
|
+
import { TagModule } from '@exhaustive-ui/core/tag';
|
|
1058
|
+
import { Customer } from '@/domain/customer';
|
|
1004
1059
|
import { CustomerService } from '@/service/customerservice';
|
|
1005
|
-
import { Customer, Country } from '@/domain/customer';
|
|
1006
1060
|
|
|
1007
1061
|
@Component({
|
|
1008
1062
|
template: `
|
|
@@ -1020,7 +1074,9 @@ import { Customer, Country } from '@/domain/customer';
|
|
|
1020
1074
|
<ng-template #groupheader let-customer let-rowIndex="rowIndex" let-expanded="expanded">
|
|
1021
1075
|
<tr>
|
|
1022
1076
|
<td colspan="5">
|
|
1023
|
-
<button type="button" pButton pRipple [pRowToggler]="customer" text rounded plain class="mr-2"
|
|
1077
|
+
<button type="button" pButton pRipple [pRowToggler]="customer" text rounded plain class="mr-2">
|
|
1078
|
+
<i [class]="expanded ? 'pi pi-chevron-down' : 'pi pi-chevron-right'" pButtonIcon></i>
|
|
1079
|
+
</button>
|
|
1024
1080
|
<img [alt]="customer.representative.name" src="https://exhaustive-ui.com/demo/avatar/{{ customer.representative.image }}" width="32" style="vertical-align: middle; display: inline-block" />
|
|
1025
1081
|
<span class="font-bold ml-2">{{ customer.representative.name }}</span>
|
|
1026
1082
|
</td>
|
|
@@ -1058,11 +1114,12 @@ import { Customer, Country } from '@/domain/customer';
|
|
|
1058
1114
|
</div>
|
|
1059
1115
|
`,
|
|
1060
1116
|
standalone: true,
|
|
1061
|
-
imports: [
|
|
1117
|
+
imports: [CommonModule, TableModule, ButtonModule, RippleModule, TagModule],
|
|
1062
1118
|
providers: [CustomerService]
|
|
1063
1119
|
})
|
|
1064
1120
|
export class TableExpandablerowgroupDemo implements OnInit {
|
|
1065
1121
|
private customerService = inject(CustomerService);
|
|
1122
|
+
|
|
1066
1123
|
customers!: Customer[];
|
|
1067
1124
|
|
|
1068
1125
|
ngOnInit() {
|
|
@@ -1073,7 +1130,7 @@ export class TableExpandablerowgroupDemo implements OnInit {
|
|
|
1073
1130
|
|
|
1074
1131
|
calculateCustomerTotal(name: string) {
|
|
1075
1132
|
let total = 0;
|
|
1076
|
-
|
|
1133
|
+
|
|
1077
1134
|
if (this.customers) {
|
|
1078
1135
|
for (let customer of this.customers) {
|
|
1079
1136
|
if (customer.representative?.name === name) {
|
|
@@ -1081,7 +1138,7 @@ export class TableExpandablerowgroupDemo implements OnInit {
|
|
|
1081
1138
|
}
|
|
1082
1139
|
}
|
|
1083
1140
|
}
|
|
1084
|
-
|
|
1141
|
+
|
|
1085
1142
|
return total;
|
|
1086
1143
|
}
|
|
1087
1144
|
|
|
@@ -1089,16 +1146,16 @@ export class TableExpandablerowgroupDemo implements OnInit {
|
|
|
1089
1146
|
switch (status) {
|
|
1090
1147
|
case 'unqualified':
|
|
1091
1148
|
return 'danger';
|
|
1092
|
-
|
|
1149
|
+
|
|
1093
1150
|
case 'qualified':
|
|
1094
1151
|
return 'success';
|
|
1095
|
-
|
|
1152
|
+
|
|
1096
1153
|
case 'new':
|
|
1097
1154
|
return 'info';
|
|
1098
|
-
|
|
1155
|
+
|
|
1099
1156
|
case 'negotiation':
|
|
1100
1157
|
return 'warn';
|
|
1101
|
-
|
|
1158
|
+
|
|
1102
1159
|
case 'renewal':
|
|
1103
1160
|
return null;
|
|
1104
1161
|
}
|
|
@@ -1111,11 +1168,12 @@ export class TableExpandablerowgroupDemo implements OnInit {
|
|
|
1111
1168
|
Table can export its data to CSV format.
|
|
1112
1169
|
|
|
1113
1170
|
```typescript
|
|
1114
|
-
import {
|
|
1171
|
+
import { CommonModule } from '@angular/common';
|
|
1172
|
+
import { Component, inject, OnInit } from '@angular/core';
|
|
1115
1173
|
import { ButtonModule } from '@exhaustive-ui/core/button';
|
|
1116
1174
|
import { TableModule } from '@exhaustive-ui/core/table';
|
|
1117
|
-
import { ProductService } from '@/service/productservice';
|
|
1118
1175
|
import { Product } from '@/domain/product';
|
|
1176
|
+
import { ProductService } from '@/service/productservice';
|
|
1119
1177
|
|
|
1120
1178
|
interface Column {
|
|
1121
1179
|
field: string;
|
|
@@ -1155,24 +1213,30 @@ interface ExportColumn {
|
|
|
1155
1213
|
</div>
|
|
1156
1214
|
`,
|
|
1157
1215
|
standalone: true,
|
|
1158
|
-
imports: [
|
|
1216
|
+
imports: [CommonModule, TableModule, ButtonModule],
|
|
1159
1217
|
providers: [ProductService]
|
|
1160
1218
|
})
|
|
1161
1219
|
export class TableExportDemo implements OnInit {
|
|
1162
1220
|
private productService = inject(ProductService);
|
|
1221
|
+
|
|
1163
1222
|
products!: Product[];
|
|
1164
|
-
|
|
1223
|
+
|
|
1224
|
+
cols!: Column[];
|
|
1225
|
+
|
|
1226
|
+
exportColumns!: ExportColumn[];
|
|
1165
1227
|
|
|
1166
1228
|
ngOnInit() {
|
|
1167
1229
|
this.productService.getProductsMini().then((data) => {
|
|
1168
1230
|
this.products = data;
|
|
1169
1231
|
});
|
|
1232
|
+
|
|
1170
1233
|
this.cols = [
|
|
1171
1234
|
{ field: 'code', header: 'Code', customExportHeader: 'Product Code' },
|
|
1172
1235
|
{ field: 'name', header: 'Name' },
|
|
1173
1236
|
{ field: 'category', header: 'Category' },
|
|
1174
1237
|
{ field: 'quantity', header: 'Quantity' }
|
|
1175
1238
|
];
|
|
1239
|
+
|
|
1176
1240
|
this.exportColumns = this.cols.map((col) => ({ title: col.header, dataKey: col.field }));
|
|
1177
1241
|
}
|
|
1178
1242
|
}
|
|
@@ -1183,20 +1247,21 @@ export class TableExportDemo implements OnInit {
|
|
|
1183
1247
|
Filters are displayed in an overlay.
|
|
1184
1248
|
|
|
1185
1249
|
```typescript
|
|
1186
|
-
import {
|
|
1250
|
+
import { CommonModule } from '@angular/common';
|
|
1251
|
+
import { Component, inject, signal, OnInit } from '@angular/core';
|
|
1187
1252
|
import { FormsModule } from '@angular/forms';
|
|
1188
1253
|
import { ButtonModule } from '@exhaustive-ui/core/button';
|
|
1189
1254
|
import { IconFieldModule } from '@exhaustive-ui/core/iconfield';
|
|
1190
1255
|
import { InputIconModule } from '@exhaustive-ui/core/inputicon';
|
|
1256
|
+
import { InputTextModule } from '@exhaustive-ui/core/inputtext';
|
|
1191
1257
|
import { MultiSelectModule } from '@exhaustive-ui/core/multiselect';
|
|
1192
1258
|
import { ProgressBarModule } from '@exhaustive-ui/core/progressbar';
|
|
1193
1259
|
import { SelectModule } from '@exhaustive-ui/core/select';
|
|
1194
1260
|
import { SliderModule } from '@exhaustive-ui/core/slider';
|
|
1195
1261
|
import { Table, TableModule } from '@exhaustive-ui/core/table';
|
|
1196
1262
|
import { TagModule } from '@exhaustive-ui/core/tag';
|
|
1197
|
-
import {
|
|
1263
|
+
import { Customer, Representative } from '@/domain/customer';
|
|
1198
1264
|
import { CustomerService } from '@/service/customerservice';
|
|
1199
|
-
import { Customer, Representative, Country } from '@/domain/customer';
|
|
1200
1265
|
|
|
1201
1266
|
@Component({
|
|
1202
1267
|
template: `
|
|
@@ -1232,7 +1297,7 @@ import { Customer, Representative, Country } from '@/domain/customer';
|
|
|
1232
1297
|
Agent
|
|
1233
1298
|
<p-column-filter field="representative" matchMode="in" display="menu" [showMatchModes]="false" [showOperator]="false" [showAddButton]="false">
|
|
1234
1299
|
<ng-template #filter let-value let-filter="filterCallback">
|
|
1235
|
-
<p-multi-select [
|
|
1300
|
+
<p-multi-select [ngModel]="value" [options]="representatives()" placeholder="Any" (onChange)="filter($event.value)" optionLabel="name" style="min-width: 14rem" [panelStyle]="{ minWidth: '16rem' }">
|
|
1236
1301
|
<ng-template let-option #item>
|
|
1237
1302
|
<div class="flex items-center gap-2">
|
|
1238
1303
|
<img [alt]="option.label" src="https://exhaustive-ui.com/demo/avatar/{{ option.image }}" style="width: 32px" />
|
|
@@ -1261,7 +1326,7 @@ import { Customer, Representative, Country } from '@/domain/customer';
|
|
|
1261
1326
|
Status
|
|
1262
1327
|
<p-column-filter field="status" matchMode="equals" display="menu">
|
|
1263
1328
|
<ng-template #filter let-value let-filter="filterCallback">
|
|
1264
|
-
<p-select [
|
|
1329
|
+
<p-select [ngModel]="value" [options]="statuses()" (onChange)="filter($event.value)" placeholder="Select One" class="w-full">
|
|
1265
1330
|
<ng-template let-option #item>
|
|
1266
1331
|
<p-tag [value]="option.value" [severity]="getSeverity(option.value)"></p-tag>
|
|
1267
1332
|
</ng-template>
|
|
@@ -1275,7 +1340,7 @@ import { Customer, Representative, Country } from '@/domain/customer';
|
|
|
1275
1340
|
Activity
|
|
1276
1341
|
<p-column-filter field="activity" matchMode="between" display="menu" [showMatchModes]="false" [showOperator]="false" [showAddButton]="false">
|
|
1277
1342
|
<ng-template #filter let-value let-filter="filterCallback">
|
|
1278
|
-
<p-slider [
|
|
1343
|
+
<p-slider [ngModel]="value" [range]="true" class="m-4" (onSlideEnd)="filter($event.values)" />
|
|
1279
1344
|
<div class="flex items-center px-2">
|
|
1280
1345
|
<span *ngIf="!value">0</span>
|
|
1281
1346
|
<span *ngIf="value">{{ value[0] }} - {{ value[1] }}</span>
|
|
@@ -1341,17 +1406,22 @@ import { Customer, Representative, Country } from '@/domain/customer';
|
|
|
1341
1406
|
</div>
|
|
1342
1407
|
`,
|
|
1343
1408
|
standalone: true,
|
|
1344
|
-
imports: [
|
|
1409
|
+
imports: [CommonModule, FormsModule, TableModule, ButtonModule, TagModule, IconFieldModule, InputIconModule, InputTextModule, MultiSelectModule, SelectModule, SliderModule, ProgressBarModule],
|
|
1345
1410
|
providers: [CustomerService]
|
|
1346
1411
|
})
|
|
1347
1412
|
export class TableFilterAdvancedDemo implements OnInit {
|
|
1348
|
-
private customerService = inject(CustomerService);
|
|
1349
1413
|
customerService = inject(CustomerService);
|
|
1414
|
+
|
|
1350
1415
|
customers = signal<Customer[]>([]);
|
|
1416
|
+
|
|
1351
1417
|
representatives = signal<Representative[]>([]);
|
|
1418
|
+
|
|
1352
1419
|
statuses = signal<any[]>([]);
|
|
1420
|
+
|
|
1353
1421
|
loading = signal(true);
|
|
1422
|
+
|
|
1354
1423
|
searchValue = signal('');
|
|
1424
|
+
|
|
1355
1425
|
activityValues = signal<number[]>([0, 100]);
|
|
1356
1426
|
|
|
1357
1427
|
ngOnInit() {
|
|
@@ -1360,6 +1430,7 @@ export class TableFilterAdvancedDemo implements OnInit {
|
|
|
1360
1430
|
this.customers.set(customers);
|
|
1361
1431
|
this.loading.set(false);
|
|
1362
1432
|
});
|
|
1433
|
+
|
|
1363
1434
|
this.representatives.set([
|
|
1364
1435
|
{ name: 'Amy Elsner', image: 'amyelsner.png' },
|
|
1365
1436
|
{ name: 'Anna Fali', image: 'annafali.png' },
|
|
@@ -1372,6 +1443,7 @@ export class TableFilterAdvancedDemo implements OnInit {
|
|
|
1372
1443
|
{ name: 'Stephen Shaw', image: 'stephenshaw.png' },
|
|
1373
1444
|
{ name: 'Xuxue Feng', image: 'xuxuefeng.png' }
|
|
1374
1445
|
]);
|
|
1446
|
+
|
|
1375
1447
|
this.statuses.set([
|
|
1376
1448
|
{ label: 'Unqualified', value: 'unqualified' },
|
|
1377
1449
|
{ label: 'Qualified', value: 'qualified' },
|
|
@@ -1391,16 +1463,16 @@ export class TableFilterAdvancedDemo implements OnInit {
|
|
|
1391
1463
|
switch (status) {
|
|
1392
1464
|
case 'unqualified':
|
|
1393
1465
|
return 'danger';
|
|
1394
|
-
|
|
1466
|
+
|
|
1395
1467
|
case 'qualified':
|
|
1396
1468
|
return 'success';
|
|
1397
|
-
|
|
1469
|
+
|
|
1398
1470
|
case 'new':
|
|
1399
1471
|
return 'info';
|
|
1400
|
-
|
|
1472
|
+
|
|
1401
1473
|
case 'negotiation':
|
|
1402
1474
|
return 'warn';
|
|
1403
|
-
|
|
1475
|
+
|
|
1404
1476
|
case 'renewal':
|
|
1405
1477
|
return null;
|
|
1406
1478
|
}
|
|
@@ -1410,20 +1482,21 @@ export class TableFilterAdvancedDemo implements OnInit {
|
|
|
1410
1482
|
|
|
1411
1483
|
## filterbasic-doc
|
|
1412
1484
|
|
|
1413
|
-
Data filtering is enabled by defining the filters property
|
|
1485
|
+
Data filtering is enabled by defining the filters property, an object of FilterMetadata keyed by field. Each column to filter also requires a p-column-filter element. Built-in filter element is an input field and using the filter template of p-column-filter , it is possible to customize the filtering with your own UI. The optional global filtering searches the data against a single value that is bound to the global key of the filters object. The fields to search against is defined with the globalFilterFields .
|
|
1414
1486
|
|
|
1415
1487
|
```typescript
|
|
1416
|
-
import { Component,
|
|
1488
|
+
import { Component, inject, OnInit } from '@angular/core';
|
|
1489
|
+
import { CommonModule } from '@angular/common';
|
|
1417
1490
|
import { FormsModule } from '@angular/forms';
|
|
1491
|
+
import { Table, TableModule } from '@exhaustive-ui/core/table';
|
|
1492
|
+
import { TagModule } from '@exhaustive-ui/core/tag';
|
|
1418
1493
|
import { IconFieldModule } from '@exhaustive-ui/core/iconfield';
|
|
1419
1494
|
import { InputIconModule } from '@exhaustive-ui/core/inputicon';
|
|
1495
|
+
import { InputTextModule } from '@exhaustive-ui/core/inputtext';
|
|
1420
1496
|
import { MultiSelectModule } from '@exhaustive-ui/core/multiselect';
|
|
1421
1497
|
import { SelectModule } from '@exhaustive-ui/core/select';
|
|
1422
|
-
import {
|
|
1423
|
-
import { TagModule } from '@exhaustive-ui/core/tag';
|
|
1424
|
-
import { InputTextModule } from '@exhaustive-ui/core/inputtext';
|
|
1498
|
+
import { Customer, Representative } from '@/domain/customer';
|
|
1425
1499
|
import { CustomerService } from '@/service/customerservice';
|
|
1426
|
-
import { Customer, Representative, Country } from '@/domain/customer';
|
|
1427
1500
|
|
|
1428
1501
|
@Component({
|
|
1429
1502
|
template: `
|
|
@@ -1467,7 +1540,7 @@ import { Customer, Representative, Country } from '@/domain/customer';
|
|
|
1467
1540
|
<th>
|
|
1468
1541
|
<p-column-filter field="representative" matchMode="in" [showMenu]="false">
|
|
1469
1542
|
<ng-template #filter let-value let-filter="filterCallback">
|
|
1470
|
-
<p-multi-select [
|
|
1543
|
+
<p-multi-select [ngModel]="value" [options]="representatives" placeholder="Any" (onChange)="filter($event.value)" optionLabel="name" style="min-width: 14rem" [panelStyle]="{ minWidth: '16rem' }">
|
|
1471
1544
|
<ng-template let-option #item>
|
|
1472
1545
|
<div class="flex items-center gap-2">
|
|
1473
1546
|
<img [alt]="option.label" src="https://exhaustive-ui.com/demo/avatar/{{ option.image }}" style="width: 32px" />
|
|
@@ -1481,7 +1554,7 @@ import { Customer, Representative, Country } from '@/domain/customer';
|
|
|
1481
1554
|
<th>
|
|
1482
1555
|
<p-column-filter field="status" matchMode="equals" [showMenu]="false">
|
|
1483
1556
|
<ng-template #filter let-value let-filter="filterCallback">
|
|
1484
|
-
<p-select [
|
|
1557
|
+
<p-select [ngModel]="value" [options]="statuses" (onChange)="filter($event.value)" placeholder="Select One" [showClear]="true" style="min-width: 12rem">
|
|
1485
1558
|
<ng-template let-option #item>
|
|
1486
1559
|
<p-tag [value]="option.value" [severity]="getSeverity(option.value)" />
|
|
1487
1560
|
</ng-template>
|
|
@@ -1534,23 +1607,31 @@ import { Customer, Representative, Country } from '@/domain/customer';
|
|
|
1534
1607
|
</div>
|
|
1535
1608
|
`,
|
|
1536
1609
|
standalone: true,
|
|
1537
|
-
imports: [
|
|
1610
|
+
imports: [CommonModule, FormsModule, TableModule, TagModule, IconFieldModule, InputIconModule, InputTextModule, MultiSelectModule, SelectModule],
|
|
1538
1611
|
providers: [CustomerService]
|
|
1539
1612
|
})
|
|
1540
1613
|
export class TableFilterbasicDemo implements OnInit {
|
|
1541
1614
|
private customerService = inject(CustomerService);
|
|
1615
|
+
|
|
1542
1616
|
customers!: Customer[];
|
|
1617
|
+
|
|
1543
1618
|
representatives!: Representative[];
|
|
1619
|
+
|
|
1544
1620
|
statuses!: any[];
|
|
1621
|
+
|
|
1545
1622
|
loading: boolean = true;
|
|
1623
|
+
|
|
1546
1624
|
activityValues: number[] = [0, 100];
|
|
1547
1625
|
|
|
1548
1626
|
ngOnInit() {
|
|
1549
1627
|
this.customerService.getCustomersLarge().then((customers) => {
|
|
1550
1628
|
this.customers = customers;
|
|
1551
1629
|
this.loading = false;
|
|
1630
|
+
|
|
1552
1631
|
this.customers.forEach((customer) => (customer.date = new Date(<Date>customer.date)));
|
|
1632
|
+
|
|
1553
1633
|
});
|
|
1634
|
+
|
|
1554
1635
|
this.representatives = [
|
|
1555
1636
|
{ name: 'Amy Elsner', image: 'amyelsner.png' },
|
|
1556
1637
|
{ name: 'Anna Fali', image: 'annafali.png' },
|
|
@@ -1563,6 +1644,7 @@ export class TableFilterbasicDemo implements OnInit {
|
|
|
1563
1644
|
{ name: 'Stephen Shaw', image: 'stephenshaw.png' },
|
|
1564
1645
|
{ name: 'Xuxue Feng', image: 'xuxuefeng.png' }
|
|
1565
1646
|
];
|
|
1647
|
+
|
|
1566
1648
|
this.statuses = [
|
|
1567
1649
|
{ label: 'Unqualified', value: 'unqualified' },
|
|
1568
1650
|
{ label: 'Qualified', value: 'qualified' },
|
|
@@ -1581,16 +1663,16 @@ export class TableFilterbasicDemo implements OnInit {
|
|
|
1581
1663
|
switch (status) {
|
|
1582
1664
|
case 'unqualified':
|
|
1583
1665
|
return 'danger';
|
|
1584
|
-
|
|
1666
|
+
|
|
1585
1667
|
case 'qualified':
|
|
1586
1668
|
return 'success';
|
|
1587
|
-
|
|
1669
|
+
|
|
1588
1670
|
case 'new':
|
|
1589
1671
|
return 'info';
|
|
1590
|
-
|
|
1672
|
+
|
|
1591
1673
|
case 'negotiation':
|
|
1592
1674
|
return 'warn';
|
|
1593
|
-
|
|
1675
|
+
|
|
1594
1676
|
case 'renewal':
|
|
1595
1677
|
return null;
|
|
1596
1678
|
}
|
|
@@ -1603,18 +1685,21 @@ export class TableFilterbasicDemo implements OnInit {
|
|
|
1603
1685
|
Flex scroll feature makes the scrollable viewport section dynamic instead of a fixed value so that it can grow or shrink relative to the parent size of the table. Click the button below to display a maximizable Dialog where data viewport adjusts itself according to the size changes.
|
|
1604
1686
|
|
|
1605
1687
|
```typescript
|
|
1606
|
-
import { Component,
|
|
1688
|
+
import { Component, inject, OnInit } from '@angular/core';
|
|
1607
1689
|
import { ButtonModule } from '@exhaustive-ui/core/button';
|
|
1608
|
-
import {
|
|
1690
|
+
import { DialogModule } from '@exhaustive-ui/core/dialog';
|
|
1609
1691
|
import { TableModule } from '@exhaustive-ui/core/table';
|
|
1692
|
+
import { Customer } from '@/domain/customer';
|
|
1610
1693
|
import { CustomerService } from '@/service/customerservice';
|
|
1611
|
-
import { Customer, Representative, Country } from '@/domain/customer';
|
|
1612
1694
|
|
|
1613
1695
|
@Component({
|
|
1614
1696
|
template: `
|
|
1615
1697
|
<div class="card">
|
|
1616
1698
|
<div class="flex justify-center">
|
|
1617
|
-
<button type="button" (click)="showDialog()" pButton
|
|
1699
|
+
<button type="button" (click)="showDialog()" pButton>
|
|
1700
|
+
<i class="pi pi-external-link" pButtonIcon></i>
|
|
1701
|
+
<span pButtonLabel>Show</span>
|
|
1702
|
+
</button>
|
|
1618
1703
|
</div>
|
|
1619
1704
|
<p-dialog header="Header" [resizable]="false" [modal]="true" [maximizable]="true" appendTo="body" [(visible)]="dialogVisible" [style]="{ width: '75vw' }" [contentStyle]="{ height: '300px' }">
|
|
1620
1705
|
<p-table [value]="customers" [scrollable]="true" scrollHeight="flex" [tableStyle]="{ 'min-width': '50rem' }">
|
|
@@ -1642,12 +1727,14 @@ import { Customer, Representative, Country } from '@/domain/customer';
|
|
|
1642
1727
|
</div>
|
|
1643
1728
|
`,
|
|
1644
1729
|
standalone: true,
|
|
1645
|
-
imports: [ButtonModule, DialogModule
|
|
1730
|
+
imports: [TableModule, ButtonModule, DialogModule],
|
|
1646
1731
|
providers: [CustomerService]
|
|
1647
1732
|
})
|
|
1648
1733
|
export class TableFlexiblescrollDemo implements OnInit {
|
|
1649
1734
|
private customerService = inject(CustomerService);
|
|
1735
|
+
|
|
1650
1736
|
customers!: Customer[];
|
|
1737
|
+
|
|
1651
1738
|
dialogVisible: boolean = false;
|
|
1652
1739
|
|
|
1653
1740
|
ngOnInit() {
|
|
@@ -1667,12 +1754,13 @@ export class TableFlexiblescrollDemo implements OnInit {
|
|
|
1667
1754
|
Certain columns can be frozen by using the pFrozenColumn directive of the table component. In addition, alignFrozen is available to define whether the column should be fixed on the left or right.
|
|
1668
1755
|
|
|
1669
1756
|
```typescript
|
|
1670
|
-
import {
|
|
1757
|
+
import { CommonModule } from '@angular/common';
|
|
1758
|
+
import { Component, inject, OnInit } from '@angular/core';
|
|
1671
1759
|
import { FormsModule } from '@angular/forms';
|
|
1672
1760
|
import { TableModule } from '@exhaustive-ui/core/table';
|
|
1673
1761
|
import { ToggleButtonModule } from '@exhaustive-ui/core/togglebutton';
|
|
1762
|
+
import { Customer } from '@/domain/customer';
|
|
1674
1763
|
import { CustomerService } from '@/service/customerservice';
|
|
1675
|
-
import { Customer, Representative, Country } from '@/domain/customer';
|
|
1676
1764
|
|
|
1677
1765
|
@Component({
|
|
1678
1766
|
template: `
|
|
@@ -1711,12 +1799,14 @@ import { Customer, Representative, Country } from '@/domain/customer';
|
|
|
1711
1799
|
</div>
|
|
1712
1800
|
`,
|
|
1713
1801
|
standalone: true,
|
|
1714
|
-
imports: [TableModule, ToggleButtonModule
|
|
1802
|
+
imports: [CommonModule, FormsModule, TableModule, ToggleButtonModule],
|
|
1715
1803
|
providers: [CustomerService]
|
|
1716
1804
|
})
|
|
1717
1805
|
export class TableFrozencolumnsDemo implements OnInit {
|
|
1718
1806
|
private customerService = inject(CustomerService);
|
|
1807
|
+
|
|
1719
1808
|
balanceFrozen: boolean = false;
|
|
1809
|
+
|
|
1720
1810
|
customers!: Customer[];
|
|
1721
1811
|
|
|
1722
1812
|
ngOnInit() {
|
|
@@ -1736,12 +1826,12 @@ export class TableFrozencolumnsDemo implements OnInit {
|
|
|
1736
1826
|
Frozen rows are used to fix certain rows while scrolling, this data is defined with the frozenValue property.
|
|
1737
1827
|
|
|
1738
1828
|
```typescript
|
|
1739
|
-
import { Component,
|
|
1740
|
-
import { TableModule } from '@exhaustive-ui/core/table';
|
|
1829
|
+
import { Component, inject, OnInit } from '@angular/core';
|
|
1741
1830
|
import { ButtonModule } from '@exhaustive-ui/core/button';
|
|
1742
1831
|
import { RippleModule } from '@exhaustive-ui/core/ripple';
|
|
1832
|
+
import { TableModule } from '@exhaustive-ui/core/table';
|
|
1833
|
+
import { Customer } from '@/domain/customer';
|
|
1743
1834
|
import { CustomerService } from '@/service/customerservice';
|
|
1744
|
-
import { Customer, Representative, Country } from '@/domain/customer';
|
|
1745
1835
|
|
|
1746
1836
|
@Component({
|
|
1747
1837
|
template: `
|
|
@@ -1763,7 +1853,9 @@ import { Customer, Representative, Country } from '@/domain/customer';
|
|
|
1763
1853
|
<td>{{ customer.company }}</td>
|
|
1764
1854
|
<td>{{ customer.representative.name }}</td>
|
|
1765
1855
|
<td>
|
|
1766
|
-
<button pButton pRipple type="button"
|
|
1856
|
+
<button pButton pRipple type="button" (click)="toggleLock(customer, true, index)" size="small" text>
|
|
1857
|
+
<i class="pi pi-lock-open" pButtonIcon></i>
|
|
1858
|
+
</button>
|
|
1767
1859
|
</td>
|
|
1768
1860
|
</tr>
|
|
1769
1861
|
</ng-template>
|
|
@@ -1774,7 +1866,9 @@ import { Customer, Representative, Country } from '@/domain/customer';
|
|
|
1774
1866
|
<td>{{ customer.company }}</td>
|
|
1775
1867
|
<td>{{ customer.representative.name }}</td>
|
|
1776
1868
|
<td>
|
|
1777
|
-
<button pButton pRipple type="button" [
|
|
1869
|
+
<button pButton pRipple type="button" [disabled]="lockedCustomers.length >= 2" (click)="toggleLock(customer, false, index)" size="small" text>
|
|
1870
|
+
<i class="pi pi-lock" pButtonIcon></i>
|
|
1871
|
+
</button>
|
|
1778
1872
|
</td>
|
|
1779
1873
|
</tr>
|
|
1780
1874
|
</ng-template>
|
|
@@ -1787,13 +1881,16 @@ import { Customer, Representative, Country } from '@/domain/customer';
|
|
|
1787
1881
|
})
|
|
1788
1882
|
export class TableFrozenrowsDemo implements OnInit {
|
|
1789
1883
|
private customerService = inject(CustomerService);
|
|
1884
|
+
|
|
1790
1885
|
unlockedCustomers!: Customer[];
|
|
1886
|
+
|
|
1791
1887
|
lockedCustomers!: Customer[];
|
|
1792
1888
|
|
|
1793
1889
|
ngOnInit() {
|
|
1794
1890
|
this.customerService.getCustomersMedium().then((data) => {
|
|
1795
1891
|
this.unlockedCustomers = data;
|
|
1796
1892
|
});
|
|
1893
|
+
|
|
1797
1894
|
this.lockedCustomers = [
|
|
1798
1895
|
{
|
|
1799
1896
|
id: 5135,
|
|
@@ -1822,7 +1919,7 @@ export class TableFrozenrowsDemo implements OnInit {
|
|
|
1822
1919
|
this.unlockedCustomers = this.unlockedCustomers.filter((c, i) => i !== index);
|
|
1823
1920
|
this.lockedCustomers.push(data);
|
|
1824
1921
|
}
|
|
1825
|
-
|
|
1922
|
+
|
|
1826
1923
|
this.unlockedCustomers.sort((val1, val2) => {
|
|
1827
1924
|
return val1.id < val2.id ? -1 : 1;
|
|
1828
1925
|
});
|
|
@@ -1835,10 +1932,10 @@ export class TableFrozenrowsDemo implements OnInit {
|
|
|
1835
1932
|
Enabling showGridlines displays borders between cells.
|
|
1836
1933
|
|
|
1837
1934
|
```typescript
|
|
1838
|
-
import { Component,
|
|
1935
|
+
import { Component, inject, OnInit } from '@angular/core';
|
|
1839
1936
|
import { TableModule } from '@exhaustive-ui/core/table';
|
|
1840
|
-
import { ProductService } from '@/service/productservice';
|
|
1841
1937
|
import { Product } from '@/domain/product';
|
|
1938
|
+
import { ProductService } from '@/service/productservice';
|
|
1842
1939
|
|
|
1843
1940
|
@Component({
|
|
1844
1941
|
template: `
|
|
@@ -1869,6 +1966,7 @@ import { Product } from '@/domain/product';
|
|
|
1869
1966
|
})
|
|
1870
1967
|
export class TableGridlinesDemo implements OnInit {
|
|
1871
1968
|
private productService = inject(ProductService);
|
|
1969
|
+
|
|
1872
1970
|
products!: Product[];
|
|
1873
1971
|
|
|
1874
1972
|
ngOnInit() {
|
|
@@ -1884,10 +1982,10 @@ export class TableGridlinesDemo implements OnInit {
|
|
|
1884
1982
|
Horizontal scrollbar is displayed when table width exceeds the parent width.
|
|
1885
1983
|
|
|
1886
1984
|
```typescript
|
|
1887
|
-
import { Component,
|
|
1985
|
+
import { Component, inject, OnInit } from '@angular/core';
|
|
1888
1986
|
import { TableModule } from '@exhaustive-ui/core/table';
|
|
1987
|
+
import { Customer } from '@/domain/customer';
|
|
1889
1988
|
import { CustomerService } from '@/service/customerservice';
|
|
1890
|
-
import { Customer, Representative, Country } from '@/domain/customer';
|
|
1891
1989
|
|
|
1892
1990
|
@Component({
|
|
1893
1991
|
template: `
|
|
@@ -1941,6 +2039,7 @@ import { Customer, Representative, Country } from '@/domain/customer';
|
|
|
1941
2039
|
})
|
|
1942
2040
|
export class TableHorizontalscrollDemo implements OnInit {
|
|
1943
2041
|
private customerService = inject(CustomerService);
|
|
2042
|
+
|
|
1944
2043
|
customers!: Customer[];
|
|
1945
2044
|
|
|
1946
2045
|
ngOnInit() {
|
|
@@ -1960,10 +2059,10 @@ export class TableHorizontalscrollDemo implements OnInit {
|
|
|
1960
2059
|
The loading property displays a mask layer to indicate busy state. Use the paginator to display the mask.
|
|
1961
2060
|
|
|
1962
2061
|
```typescript
|
|
1963
|
-
import { Component,
|
|
2062
|
+
import { Component, inject, OnInit } from '@angular/core';
|
|
1964
2063
|
import { TableModule } from '@exhaustive-ui/core/table';
|
|
1965
|
-
import { ProductService } from '@/service/productservice';
|
|
1966
2064
|
import { Product } from '@/domain/product';
|
|
2065
|
+
import { ProductService } from '@/service/productservice';
|
|
1967
2066
|
|
|
1968
2067
|
@Component({
|
|
1969
2068
|
template: `
|
|
@@ -1994,6 +2093,7 @@ import { Product } from '@/domain/product';
|
|
|
1994
2093
|
})
|
|
1995
2094
|
export class TableLoadingmaskDemo implements OnInit {
|
|
1996
2095
|
private productService = inject(ProductService);
|
|
2096
|
+
|
|
1997
2097
|
products!: Product[];
|
|
1998
2098
|
|
|
1999
2099
|
ngOnInit() {
|
|
@@ -2038,7 +2138,7 @@ import { Product } from '@/domain/product';
|
|
|
2038
2138
|
</div>
|
|
2039
2139
|
`,
|
|
2040
2140
|
standalone: true,
|
|
2041
|
-
imports: [
|
|
2141
|
+
imports: [TableModule, SkeletonModule]
|
|
2042
2142
|
})
|
|
2043
2143
|
export class TableLoadingskeletonDemo implements OnInit {
|
|
2044
2144
|
products!: Product[];
|
|
@@ -2054,10 +2154,10 @@ export class TableLoadingskeletonDemo implements OnInit {
|
|
|
2054
2154
|
Multiple columns can be sorted by defining sortMode as multiple . This mode requires metaKey (e.g. ⌘ ) to be pressed when clicking a header.
|
|
2055
2155
|
|
|
2056
2156
|
```typescript
|
|
2057
|
-
import { Component,
|
|
2157
|
+
import { Component, inject, OnInit } from '@angular/core';
|
|
2058
2158
|
import { TableModule } from '@exhaustive-ui/core/table';
|
|
2059
|
-
import { ProductService } from '@/service/productservice';
|
|
2060
2159
|
import { Product } from '@/domain/product';
|
|
2160
|
+
import { ProductService } from '@/service/productservice';
|
|
2061
2161
|
|
|
2062
2162
|
@Component({
|
|
2063
2163
|
template: `
|
|
@@ -2108,6 +2208,7 @@ import { Product } from '@/domain/product';
|
|
|
2108
2208
|
})
|
|
2109
2209
|
export class TableMultiplecolumnssortDemo implements OnInit {
|
|
2110
2210
|
private productService = inject(ProductService);
|
|
2211
|
+
|
|
2111
2212
|
products: Product[];
|
|
2112
2213
|
|
|
2113
2214
|
ngOnInit() {
|
|
@@ -2123,12 +2224,13 @@ export class TableMultiplecolumnssortDemo implements OnInit {
|
|
|
2123
2224
|
More than one row is selectable by setting selectionMode to multiple . By default in multiple selection mode, metaKey press (e.g. ⌘ ) is not necessary to add to existing selections. When the optional metaKeySelection is present, behavior is changed in a way that selecting a new row requires meta key to be present. Note that in touch enabled devices, DataTable always ignores metaKey.
|
|
2124
2225
|
|
|
2125
2226
|
```typescript
|
|
2126
|
-
import {
|
|
2227
|
+
import { CommonModule } from '@angular/common';
|
|
2228
|
+
import { Component, inject, OnInit } from '@angular/core';
|
|
2127
2229
|
import { FormsModule } from '@angular/forms';
|
|
2128
2230
|
import { TableModule } from '@exhaustive-ui/core/table';
|
|
2129
2231
|
import { ToggleSwitchModule } from '@exhaustive-ui/core/toggleswitch';
|
|
2130
|
-
import { ProductService } from '@/service/productservice';
|
|
2131
2232
|
import { Product } from '@/domain/product';
|
|
2233
|
+
import { ProductService } from '@/service/productservice';
|
|
2132
2234
|
|
|
2133
2235
|
@Component({
|
|
2134
2236
|
template: `
|
|
@@ -2158,13 +2260,16 @@ import { Product } from '@/domain/product';
|
|
|
2158
2260
|
</div>
|
|
2159
2261
|
`,
|
|
2160
2262
|
standalone: true,
|
|
2161
|
-
imports: [TableModule, ToggleSwitchModule
|
|
2263
|
+
imports: [CommonModule, FormsModule, TableModule, ToggleSwitchModule],
|
|
2162
2264
|
providers: [ProductService]
|
|
2163
2265
|
})
|
|
2164
2266
|
export class TableMultipleselectionDemo implements OnInit {
|
|
2165
2267
|
private productService = inject(ProductService);
|
|
2268
|
+
|
|
2166
2269
|
products!: Product[];
|
|
2270
|
+
|
|
2167
2271
|
selectedProducts!: Product;
|
|
2272
|
+
|
|
2168
2273
|
metaKey: boolean = true;
|
|
2169
2274
|
|
|
2170
2275
|
ngOnInit() {
|
|
@@ -2180,10 +2285,10 @@ export class TableMultipleselectionDemo implements OnInit {
|
|
|
2180
2285
|
Pagination is enabled by setting paginator property to true and defining a rows property to specify the number of rows per page.
|
|
2181
2286
|
|
|
2182
2287
|
```typescript
|
|
2183
|
-
import { Component,
|
|
2288
|
+
import { Component, inject, OnInit } from '@angular/core';
|
|
2184
2289
|
import { TableModule } from '@exhaustive-ui/core/table';
|
|
2290
|
+
import { Customer } from '@/domain/customer';
|
|
2185
2291
|
import { CustomerService } from '@/service/customerservice';
|
|
2186
|
-
import { Customer, Representative, Country } from '@/domain/customer';
|
|
2187
2292
|
|
|
2188
2293
|
@Component({
|
|
2189
2294
|
template: `
|
|
@@ -2214,6 +2319,7 @@ import { Customer, Representative, Country } from '@/domain/customer';
|
|
|
2214
2319
|
})
|
|
2215
2320
|
export class TablePaginatorbasicDemo implements OnInit {
|
|
2216
2321
|
private customerService = inject(CustomerService);
|
|
2322
|
+
|
|
2217
2323
|
customers!: Customer[];
|
|
2218
2324
|
|
|
2219
2325
|
ngOnInit() {
|
|
@@ -2229,11 +2335,11 @@ export class TablePaginatorbasicDemo implements OnInit {
|
|
|
2229
2335
|
Paginator can also be controlled via model using a binding to the first property where changes trigger a pagination.
|
|
2230
2336
|
|
|
2231
2337
|
```typescript
|
|
2232
|
-
import { Component,
|
|
2338
|
+
import { Component, inject, OnInit } from '@angular/core';
|
|
2233
2339
|
import { ButtonModule } from '@exhaustive-ui/core/button';
|
|
2234
2340
|
import { TableModule } from '@exhaustive-ui/core/table';
|
|
2341
|
+
import { Customer } from '@/domain/customer';
|
|
2235
2342
|
import { CustomerService } from '@/service/customerservice';
|
|
2236
|
-
import { Customer, Representative, Country } from '@/domain/customer';
|
|
2237
2343
|
|
|
2238
2344
|
@Component({
|
|
2239
2345
|
template: `
|
|
@@ -2274,14 +2380,17 @@ import { Customer, Representative, Country } from '@/domain/customer';
|
|
|
2274
2380
|
</div>
|
|
2275
2381
|
`,
|
|
2276
2382
|
standalone: true,
|
|
2277
|
-
imports: [
|
|
2383
|
+
imports: [TableModule, ButtonModule],
|
|
2278
2384
|
providers: [CustomerService]
|
|
2279
2385
|
})
|
|
2280
2386
|
export class TablePaginatorprogrammaticDemo implements OnInit {
|
|
2281
2387
|
private customerService = inject(CustomerService);
|
|
2388
|
+
|
|
2282
2389
|
customers!: Customer[];
|
|
2283
|
-
|
|
2284
|
-
|
|
2390
|
+
|
|
2391
|
+
first = 0;
|
|
2392
|
+
|
|
2393
|
+
rows = 10;
|
|
2285
2394
|
|
|
2286
2395
|
ngOnInit() {
|
|
2287
2396
|
this.customerService.getCustomersLarge().then((customers) => {
|
|
@@ -2321,10 +2430,11 @@ export class TablePaginatorprogrammaticDemo implements OnInit {
|
|
|
2321
2430
|
Defining a default sortField and sortOrder displays data as sorted initially in single column sorting. In multiple sort mode, multiSortMeta should be used instead by providing an array of DataTableSortMeta objects.
|
|
2322
2431
|
|
|
2323
2432
|
```typescript
|
|
2324
|
-
import {
|
|
2433
|
+
import { CommonModule } from '@angular/common';
|
|
2434
|
+
import { Component, inject, OnInit } from '@angular/core';
|
|
2325
2435
|
import { TableModule } from '@exhaustive-ui/core/table';
|
|
2326
|
-
import { ProductService } from '@/service/productservice';
|
|
2327
2436
|
import { Product } from '@/domain/product';
|
|
2437
|
+
import { ProductService } from '@/service/productservice';
|
|
2328
2438
|
|
|
2329
2439
|
@Component({
|
|
2330
2440
|
template: `
|
|
@@ -2377,11 +2487,12 @@ import { Product } from '@/domain/product';
|
|
|
2377
2487
|
</div>
|
|
2378
2488
|
`,
|
|
2379
2489
|
standalone: true,
|
|
2380
|
-
imports: [TableModule],
|
|
2490
|
+
imports: [TableModule, CommonModule],
|
|
2381
2491
|
providers: [ProductService]
|
|
2382
2492
|
})
|
|
2383
2493
|
export class TablePresortDemo implements OnInit {
|
|
2384
2494
|
private productService = inject(ProductService);
|
|
2495
|
+
|
|
2385
2496
|
products!: Product[];
|
|
2386
2497
|
|
|
2387
2498
|
ngOnInit() {
|
|
@@ -2397,26 +2508,28 @@ export class TablePresortDemo implements OnInit {
|
|
|
2397
2508
|
CRUD implementation example with a Dialog.
|
|
2398
2509
|
|
|
2399
2510
|
```typescript
|
|
2400
|
-
import {
|
|
2511
|
+
import { CommonModule } from '@angular/common';
|
|
2512
|
+
import { Component, ViewChild, inject, OnInit } from '@angular/core';
|
|
2401
2513
|
import { FormsModule } from '@angular/forms';
|
|
2514
|
+
import { ConfirmationService, MessageService } from '@exhaustive-ui/core/api';
|
|
2402
2515
|
import { ButtonModule } from '@exhaustive-ui/core/button';
|
|
2403
2516
|
import { ConfirmDialogModule } from '@exhaustive-ui/core/confirmdialog';
|
|
2404
|
-
import {
|
|
2517
|
+
import { DialogModule } from '@exhaustive-ui/core/dialog';
|
|
2405
2518
|
import { FileUploadModule } from '@exhaustive-ui/core/fileupload';
|
|
2406
2519
|
import { IconFieldModule } from '@exhaustive-ui/core/iconfield';
|
|
2407
2520
|
import { InputIconModule } from '@exhaustive-ui/core/inputicon';
|
|
2408
2521
|
import { InputNumberModule } from '@exhaustive-ui/core/inputnumber';
|
|
2522
|
+
import { InputTextModule } from '@exhaustive-ui/core/inputtext';
|
|
2409
2523
|
import { RadioButtonModule } from '@exhaustive-ui/core/radiobutton';
|
|
2410
2524
|
import { RatingModule } from '@exhaustive-ui/core/rating';
|
|
2411
2525
|
import { SelectModule } from '@exhaustive-ui/core/select';
|
|
2412
2526
|
import { Table, TableModule } from '@exhaustive-ui/core/table';
|
|
2413
2527
|
import { TagModule } from '@exhaustive-ui/core/tag';
|
|
2528
|
+
import { TextareaModule } from '@exhaustive-ui/core/textarea';
|
|
2414
2529
|
import { ToastModule } from '@exhaustive-ui/core/toast';
|
|
2415
2530
|
import { ToolbarModule } from '@exhaustive-ui/core/toolbar';
|
|
2416
|
-
import { InputTextModule } from '@exhaustive-ui/core/inputtext';
|
|
2417
|
-
import { ProductService } from '@/service/productservice';
|
|
2418
|
-
import { MessageService, ConfirmationService } from '@exhaustive-ui/core/api';
|
|
2419
2531
|
import { Product } from '@/domain/product';
|
|
2532
|
+
import { ProductService } from '@/service/productservice';
|
|
2420
2533
|
|
|
2421
2534
|
interface Column {
|
|
2422
2535
|
field: string;
|
|
@@ -2439,7 +2552,7 @@ interface ExportColumn {
|
|
|
2439
2552
|
<p-button severity="danger" label="Delete" icon="pi pi-trash" outlined (onClick)="deleteSelectedProducts()" [disabled]="!selectedProducts || !selectedProducts.length" />
|
|
2440
2553
|
</ng-template>
|
|
2441
2554
|
<ng-template #end>
|
|
2442
|
-
<p-file-upload mode="basic" accept="image/*" [maxFileSize]="1000000"
|
|
2555
|
+
<p-file-upload mode="basic" accept="image/*" [maxFileSize]="1000000" chooseLabel="Import" auto customUpload class="mr-2 inline-block" [chooseButtonProps]="{ severity: 'secondary' }" />
|
|
2443
2556
|
<p-button label="Export" icon="pi pi-upload" severity="secondary" (onClick)="exportCSV($event)" />
|
|
2444
2557
|
</ng-template>
|
|
2445
2558
|
</p-toolbar>
|
|
@@ -2590,31 +2703,47 @@ interface ExportColumn {
|
|
|
2590
2703
|
</div>
|
|
2591
2704
|
`,
|
|
2592
2705
|
standalone: true,
|
|
2593
|
-
imports: [
|
|
2594
|
-
providers: [
|
|
2706
|
+
imports: [CommonModule, IconFieldModule, InputIconModule, FormsModule, TableModule, ToastModule, ToolbarModule, ButtonModule, FileUploadModule, RatingModule, DialogModule, InputTextModule, InputNumberModule, SelectModule, RadioButtonModule, TagModule, ConfirmDialogModule, TextareaModule],
|
|
2707
|
+
providers: [MessageService, ConfirmationService, ProductService]
|
|
2595
2708
|
})
|
|
2596
2709
|
export class TableProductsDemo implements OnInit {
|
|
2597
2710
|
private productService = inject(ProductService);
|
|
2598
2711
|
private messageService = inject(MessageService);
|
|
2599
2712
|
private confirmationService = inject(ConfirmationService);
|
|
2713
|
+
|
|
2600
2714
|
productDialog: boolean = false;
|
|
2715
|
+
|
|
2601
2716
|
products!: Product[];
|
|
2717
|
+
|
|
2602
2718
|
product!: Product;
|
|
2719
|
+
|
|
2603
2720
|
selectedProducts!: Product[] | null;
|
|
2721
|
+
|
|
2604
2722
|
submitted: boolean = false;
|
|
2723
|
+
|
|
2605
2724
|
statuses!: any[];
|
|
2725
|
+
|
|
2726
|
+
@ViewChild('dt') dt!: Table;
|
|
2727
|
+
|
|
2606
2728
|
cols!: Column[];
|
|
2729
|
+
|
|
2607
2730
|
exportColumns!: ExportColumn[];
|
|
2608
2731
|
|
|
2732
|
+
exportCSV() {
|
|
2733
|
+
this.dt.exportCSV();
|
|
2734
|
+
}
|
|
2735
|
+
|
|
2609
2736
|
ngOnInit() {
|
|
2610
2737
|
this.productService.getProducts().then((data) => {
|
|
2611
2738
|
this.products = data;
|
|
2612
2739
|
});
|
|
2740
|
+
|
|
2613
2741
|
this.statuses = [
|
|
2614
2742
|
{ label: 'INSTOCK', value: 'instock' },
|
|
2615
2743
|
{ label: 'LOWSTOCK', value: 'lowstock' },
|
|
2616
2744
|
{ label: 'OUTOFSTOCK', value: 'outofstock' }
|
|
2617
2745
|
];
|
|
2746
|
+
|
|
2618
2747
|
this.cols = [
|
|
2619
2748
|
{ field: 'code', header: 'Code', customExportHeader: 'Product Code' },
|
|
2620
2749
|
{ field: 'name', header: 'Name' },
|
|
@@ -2622,6 +2751,7 @@ export class TableProductsDemo implements OnInit {
|
|
|
2622
2751
|
{ field: 'price', header: 'Price' },
|
|
2623
2752
|
{ field: 'category', header: 'Category' }
|
|
2624
2753
|
];
|
|
2754
|
+
|
|
2625
2755
|
this.exportColumns = this.cols.map((col) => ({ title: col.header, dataKey: col.field }));
|
|
2626
2756
|
}
|
|
2627
2757
|
|
|
@@ -2703,7 +2833,7 @@ export class TableProductsDemo implements OnInit {
|
|
|
2703
2833
|
break;
|
|
2704
2834
|
}
|
|
2705
2835
|
}
|
|
2706
|
-
|
|
2836
|
+
|
|
2707
2837
|
return index;
|
|
2708
2838
|
}
|
|
2709
2839
|
|
|
@@ -2729,7 +2859,7 @@ export class TableProductsDemo implements OnInit {
|
|
|
2729
2859
|
|
|
2730
2860
|
saveProduct() {
|
|
2731
2861
|
this.submitted = true;
|
|
2732
|
-
|
|
2862
|
+
|
|
2733
2863
|
if (this.product.name?.trim()) {
|
|
2734
2864
|
if (this.product.id) {
|
|
2735
2865
|
this.products[this.findIndexById(this.product.id)] = this.product;
|
|
@@ -2751,7 +2881,7 @@ export class TableProductsDemo implements OnInit {
|
|
|
2751
2881
|
life: 3000
|
|
2752
2882
|
});
|
|
2753
2883
|
}
|
|
2754
|
-
|
|
2884
|
+
|
|
2755
2885
|
this.products = [...this.products];
|
|
2756
2886
|
this.productDialog = false;
|
|
2757
2887
|
this.product = {};
|
|
@@ -2765,10 +2895,10 @@ export class TableProductsDemo implements OnInit {
|
|
|
2765
2895
|
Single selection can also be handled using radio buttons.
|
|
2766
2896
|
|
|
2767
2897
|
```typescript
|
|
2768
|
-
import { Component,
|
|
2898
|
+
import { Component, inject, OnInit } from '@angular/core';
|
|
2769
2899
|
import { TableModule } from '@exhaustive-ui/core/table';
|
|
2770
|
-
import { ProductService } from '@/service/productservice';
|
|
2771
2900
|
import { Product } from '@/domain/product';
|
|
2901
|
+
import { ProductService } from '@/service/productservice';
|
|
2772
2902
|
|
|
2773
2903
|
@Component({
|
|
2774
2904
|
template: `
|
|
@@ -2803,7 +2933,9 @@ import { Product } from '@/domain/product';
|
|
|
2803
2933
|
})
|
|
2804
2934
|
export class TableRadiobuttonselectionDemo implements OnInit {
|
|
2805
2935
|
private productService = inject(ProductService);
|
|
2936
|
+
|
|
2806
2937
|
products!: Product[];
|
|
2938
|
+
|
|
2807
2939
|
selectedProduct!: Product;
|
|
2808
2940
|
|
|
2809
2941
|
ngOnInit() {
|
|
@@ -2819,11 +2951,11 @@ export class TableRadiobuttonselectionDemo implements OnInit {
|
|
|
2819
2951
|
The removable sort can be implemented using the customSort property.
|
|
2820
2952
|
|
|
2821
2953
|
```typescript
|
|
2822
|
-
import { Component,
|
|
2823
|
-
import { Table, TableModule } from '@exhaustive-ui/core/table';
|
|
2824
|
-
import { ProductService } from '@/service/productservice';
|
|
2954
|
+
import { Component, ViewChild, inject, OnInit } from '@angular/core';
|
|
2825
2955
|
import { SortEvent } from '@exhaustive-ui/core/api';
|
|
2956
|
+
import { Table, TableModule } from '@exhaustive-ui/core/table';
|
|
2826
2957
|
import { Product } from '@/domain/product';
|
|
2958
|
+
import { ProductService } from '@/service/productservice';
|
|
2827
2959
|
|
|
2828
2960
|
@Component({
|
|
2829
2961
|
template: `
|
|
@@ -2874,8 +3006,13 @@ import { Product } from '@/domain/product';
|
|
|
2874
3006
|
})
|
|
2875
3007
|
export class TableRemovablesortDemo implements OnInit {
|
|
2876
3008
|
private productService = inject(ProductService);
|
|
3009
|
+
|
|
3010
|
+
@ViewChild('dt') dt: Table;
|
|
3011
|
+
|
|
2877
3012
|
products: Product[];
|
|
3013
|
+
|
|
2878
3014
|
initialValue: Product[];
|
|
3015
|
+
|
|
2879
3016
|
isSorted: boolean = null;
|
|
2880
3017
|
|
|
2881
3018
|
ngOnInit() {
|
|
@@ -2909,7 +3046,7 @@ export class TableRemovablesortDemo implements OnInit {
|
|
|
2909
3046
|
else if (value1 == null && value2 == null) result = 0;
|
|
2910
3047
|
else if (typeof value1 === 'string' && typeof value2 === 'string') result = value1.localeCompare(value2);
|
|
2911
3048
|
else result = value1 < value2 ? -1 : value1 > value2 ? 1 : 0;
|
|
2912
|
-
|
|
3049
|
+
|
|
2913
3050
|
return event.order * result;
|
|
2914
3051
|
});
|
|
2915
3052
|
}
|
|
@@ -2918,13 +3055,14 @@ export class TableRemovablesortDemo implements OnInit {
|
|
|
2918
3055
|
|
|
2919
3056
|
## Reorder
|
|
2920
3057
|
|
|
2921
|
-
Order of the columns and rows can be changed using drag and drop. Column reordering is configured by adding reorderableColumns property. Similarly,
|
|
3058
|
+
Order of the columns and rows can be changed using drag and drop. Column reordering is configured by adding reorderableColumns property. Similarly, rows become draggable by adding the pReorderableRow directive with the row index to the row element. For the drag handle an element needs the pReorderableRowHandle directive and onRowReorder is emitted after reorder completes.
|
|
2922
3059
|
|
|
2923
3060
|
```typescript
|
|
2924
|
-
import {
|
|
3061
|
+
import { CommonModule } from '@angular/common';
|
|
3062
|
+
import { Component, inject, OnInit } from '@angular/core';
|
|
2925
3063
|
import { TableModule } from '@exhaustive-ui/core/table';
|
|
2926
|
-
import { ProductService } from '@/service/productservice';
|
|
2927
3064
|
import { Product } from '@/domain/product';
|
|
3065
|
+
import { ProductService } from '@/service/productservice';
|
|
2928
3066
|
|
|
2929
3067
|
interface Column {
|
|
2930
3068
|
field: string;
|
|
@@ -2957,18 +3095,21 @@ interface Column {
|
|
|
2957
3095
|
</div>
|
|
2958
3096
|
`,
|
|
2959
3097
|
standalone: true,
|
|
2960
|
-
imports: [TableModule],
|
|
3098
|
+
imports: [CommonModule, TableModule],
|
|
2961
3099
|
providers: [ProductService]
|
|
2962
3100
|
})
|
|
2963
3101
|
export class TableReorderDemo implements OnInit {
|
|
2964
3102
|
private productService = inject(ProductService);
|
|
3103
|
+
|
|
2965
3104
|
products!: Product[];
|
|
3105
|
+
|
|
2966
3106
|
cols!: Column[];
|
|
2967
3107
|
|
|
2968
3108
|
ngOnInit() {
|
|
2969
3109
|
this.productService.getProductsMini().then((data) => {
|
|
2970
3110
|
this.products = data;
|
|
2971
3111
|
});
|
|
3112
|
+
|
|
2972
3113
|
this.cols = [
|
|
2973
3114
|
{ field: 'code', header: 'Code' },
|
|
2974
3115
|
{ field: 'name', header: 'Name' },
|
|
@@ -2984,18 +3125,19 @@ export class TableReorderDemo implements OnInit {
|
|
|
2984
3125
|
Row editing toggles the visibility of all the editors in the row at once and provides additional options to save and cancel editing. Row editing functionality is enabled by setting the editMode to "row" on table, defining a dataKey to uniquely identify a row, adding pEditableRow directive to the editable rows and defining the UI Controls with pInitEditableRow , pSaveEditableRow and pCancelEditableRow directives respectively. Save and Cancel functionality implementation is left to the page author to provide more control over the editing business logic. Example below utilizes a simple implementation where a row is cloned when editing is initialized and is saved or restored depending on the result of the editing. An implicit variable called "editing" is passed to the body template so you may come up with your own UI controls that implement editing based on your own requirements such as adding validations and styling. Note that pSaveEditableRow only switches the row to back view mode when there are no validation errors. Moreover, you may use setting pEditableRowDisabled property as true to disable editing for that particular row and in case you need to display rows in edit mode by default, use the editingRowKeys property which is a map whose key is the dataKey of the record where the value is any arbitrary number greater than zero.
|
|
2985
3126
|
|
|
2986
3127
|
```typescript
|
|
2987
|
-
import {
|
|
3128
|
+
import { CommonModule } from '@angular/common';
|
|
3129
|
+
import { Component, inject, OnInit } from '@angular/core';
|
|
2988
3130
|
import { FormsModule } from '@angular/forms';
|
|
3131
|
+
import { MessageService, SelectItem } from '@exhaustive-ui/core/api';
|
|
3132
|
+
import { ButtonModule } from '@exhaustive-ui/core/button';
|
|
3133
|
+
import { InputTextModule } from '@exhaustive-ui/core/inputtext';
|
|
3134
|
+
import { RippleModule } from '@exhaustive-ui/core/ripple';
|
|
2989
3135
|
import { SelectModule } from '@exhaustive-ui/core/select';
|
|
2990
3136
|
import { TableModule } from '@exhaustive-ui/core/table';
|
|
2991
3137
|
import { TagModule } from '@exhaustive-ui/core/tag';
|
|
2992
3138
|
import { ToastModule } from '@exhaustive-ui/core/toast';
|
|
2993
|
-
import { ButtonModule } from '@exhaustive-ui/core/button';
|
|
2994
|
-
import { InputTextModule } from '@exhaustive-ui/core/inputtext';
|
|
2995
|
-
import { RippleModule } from '@exhaustive-ui/core/ripple';
|
|
2996
|
-
import { ProductService } from '@/service/productservice';
|
|
2997
|
-
import { SelectItem, MessageService } from '@exhaustive-ui/core/api';
|
|
2998
3139
|
import { Product } from '@/domain/product';
|
|
3140
|
+
import { ProductService } from '@/service/productservice';
|
|
2999
3141
|
|
|
3000
3142
|
@Component({
|
|
3001
3143
|
template: `
|
|
@@ -3055,9 +3197,15 @@ import { Product } from '@/domain/product';
|
|
|
3055
3197
|
</td>
|
|
3056
3198
|
<td>
|
|
3057
3199
|
<div class="flex items-center justify-center gap-2">
|
|
3058
|
-
<button *ngIf="!editing" pButton pRipple type="button" pInitEditableRow
|
|
3059
|
-
|
|
3060
|
-
|
|
3200
|
+
<button *ngIf="!editing" pButton pRipple type="button" pInitEditableRow (click)="onRowEditInit(product)" text rounded severity="secondary">
|
|
3201
|
+
<i class="pi pi-pencil" pButtonIcon></i>
|
|
3202
|
+
</button>
|
|
3203
|
+
<button *ngIf="editing" pButton pRipple type="button" pSaveEditableRow (click)="onRowEditSave(product)" text rounded severity="secondary">
|
|
3204
|
+
<i class="pi pi-check" pButtonIcon></i>
|
|
3205
|
+
</button>
|
|
3206
|
+
<button *ngIf="editing" pButton pRipple type="button" pCancelEditableRow (click)="onRowEditCancel(product, ri)" text rounded severity="secondary">
|
|
3207
|
+
<i class="pi pi-times" pButtonIcon></i>
|
|
3208
|
+
</button>
|
|
3061
3209
|
</div>
|
|
3062
3210
|
</td>
|
|
3063
3211
|
</tr>
|
|
@@ -3066,19 +3214,24 @@ import { Product } from '@/domain/product';
|
|
|
3066
3214
|
</div>
|
|
3067
3215
|
`,
|
|
3068
3216
|
standalone: true,
|
|
3069
|
-
imports: [
|
|
3070
|
-
providers: [
|
|
3217
|
+
imports: [CommonModule, FormsModule, TableModule, ToastModule, InputTextModule, SelectModule, TagModule, ButtonModule, RippleModule],
|
|
3218
|
+
providers: [MessageService, ProductService]
|
|
3071
3219
|
})
|
|
3072
3220
|
export class TableRoweditDemo implements OnInit {
|
|
3073
3221
|
private productService = inject(ProductService);
|
|
3074
3222
|
private messageService = inject(MessageService);
|
|
3223
|
+
|
|
3075
3224
|
products!: Product[];
|
|
3225
|
+
|
|
3076
3226
|
statuses!: SelectItem[];
|
|
3077
3227
|
|
|
3228
|
+
clonedProducts: { [s: string]: Product } = {};
|
|
3229
|
+
|
|
3078
3230
|
ngOnInit() {
|
|
3079
3231
|
this.productService.getProductsMini().then((data) => {
|
|
3080
3232
|
this.products = data;
|
|
3081
3233
|
});
|
|
3234
|
+
|
|
3082
3235
|
this.statuses = [
|
|
3083
3236
|
{ label: 'In Stock', value: 'INSTOCK' },
|
|
3084
3237
|
{ label: 'Low Stock', value: 'LOWSTOCK' },
|
|
@@ -3122,18 +3275,18 @@ export class TableRoweditDemo implements OnInit {
|
|
|
3122
3275
|
Row expansion allows displaying detailed content for a particular row. To use this feature, define a dataKey , add a template named expandedrow and use the pRowToggler directive on an element as the target to toggle an expansion. This enables providing your custom UI such as buttons, links and so on. Example below uses an anchor with an icon as a toggler. Setting pRowTogglerDisabled as true disables the toggle event for the element.
|
|
3123
3276
|
|
|
3124
3277
|
```typescript
|
|
3125
|
-
import {
|
|
3278
|
+
import { CommonModule } from '@angular/common';
|
|
3279
|
+
import { Component, inject, OnInit } from '@angular/core';
|
|
3126
3280
|
import { FormsModule } from '@angular/forms';
|
|
3281
|
+
import { MessageService } from '@exhaustive-ui/core/api';
|
|
3127
3282
|
import { ButtonModule } from '@exhaustive-ui/core/button';
|
|
3128
3283
|
import { RatingModule } from '@exhaustive-ui/core/rating';
|
|
3129
|
-
import {
|
|
3284
|
+
import { RippleModule } from '@exhaustive-ui/core/ripple';
|
|
3285
|
+
import { TableModule, TableRowCollapseEvent, TableRowExpandEvent } from '@exhaustive-ui/core/table';
|
|
3130
3286
|
import { TagModule } from '@exhaustive-ui/core/tag';
|
|
3131
3287
|
import { ToastModule } from '@exhaustive-ui/core/toast';
|
|
3132
|
-
import { RippleModule } from '@exhaustive-ui/core/ripple';
|
|
3133
|
-
import { ProductService } from '@/service/productservice';
|
|
3134
|
-
import { MessageService } from '@exhaustive-ui/core/api';
|
|
3135
3288
|
import { Product } from '@/domain/product';
|
|
3136
|
-
import {
|
|
3289
|
+
import { ProductService } from '@/service/productservice';
|
|
3137
3290
|
|
|
3138
3291
|
@Component({
|
|
3139
3292
|
template: `
|
|
@@ -3245,14 +3398,16 @@ import { Customer } from '@/domain/customer';
|
|
|
3245
3398
|
</div>
|
|
3246
3399
|
`,
|
|
3247
3400
|
standalone: true,
|
|
3248
|
-
imports: [
|
|
3249
|
-
providers: [
|
|
3401
|
+
imports: [TableModule, ToastModule, ButtonModule, FormsModule, RippleModule, CommonModule, RatingModule, TagModule],
|
|
3402
|
+
providers: [MessageService, ProductService]
|
|
3250
3403
|
})
|
|
3251
3404
|
export class TableRowexpansionDemo implements OnInit {
|
|
3252
3405
|
private productService = inject(ProductService);
|
|
3253
3406
|
private messageService = inject(MessageService);
|
|
3407
|
+
|
|
3254
3408
|
products!: Product[];
|
|
3255
|
-
|
|
3409
|
+
|
|
3410
|
+
expandedRows = {};
|
|
3256
3411
|
|
|
3257
3412
|
ngOnInit() {
|
|
3258
3413
|
this.productService.getProductsWithOrdersSmall().then((data) => {
|
|
@@ -3310,11 +3465,12 @@ export class TableRowexpansionDemo implements OnInit {
|
|
|
3310
3465
|
When rowGroupMode is configured to be rowspan , the grouping column spans multiple rows.
|
|
3311
3466
|
|
|
3312
3467
|
```typescript
|
|
3313
|
-
import {
|
|
3468
|
+
import { CommonModule } from '@angular/common';
|
|
3469
|
+
import { Component, inject, OnInit } from '@angular/core';
|
|
3314
3470
|
import { TableModule } from '@exhaustive-ui/core/table';
|
|
3315
3471
|
import { TagModule } from '@exhaustive-ui/core/tag';
|
|
3472
|
+
import { Customer } from '@/domain/customer';
|
|
3316
3473
|
import { CustomerService } from '@/service/customerservice';
|
|
3317
|
-
import { Customer, Representative, Country } from '@/domain/customer';
|
|
3318
3474
|
|
|
3319
3475
|
@Component({
|
|
3320
3476
|
template: `
|
|
@@ -3360,11 +3516,12 @@ import { Customer, Representative, Country } from '@/domain/customer';
|
|
|
3360
3516
|
</div>
|
|
3361
3517
|
`,
|
|
3362
3518
|
standalone: true,
|
|
3363
|
-
imports: [TableModule, TagModule],
|
|
3519
|
+
imports: [CommonModule, TableModule, TagModule],
|
|
3364
3520
|
providers: [CustomerService]
|
|
3365
3521
|
})
|
|
3366
3522
|
export class TableRowspangroupingDemo implements OnInit {
|
|
3367
3523
|
private customerService = inject(CustomerService);
|
|
3524
|
+
|
|
3368
3525
|
customers!: Customer[];
|
|
3369
3526
|
|
|
3370
3527
|
ngOnInit() {
|
|
@@ -3375,7 +3532,7 @@ export class TableRowspangroupingDemo implements OnInit {
|
|
|
3375
3532
|
|
|
3376
3533
|
calculateCustomerTotal(name: string) {
|
|
3377
3534
|
let total = 0;
|
|
3378
|
-
|
|
3535
|
+
|
|
3379
3536
|
if (this.customers) {
|
|
3380
3537
|
for (let customer of this.customers) {
|
|
3381
3538
|
if (customer.representative?.name === name) {
|
|
@@ -3383,7 +3540,7 @@ export class TableRowspangroupingDemo implements OnInit {
|
|
|
3383
3540
|
}
|
|
3384
3541
|
}
|
|
3385
3542
|
}
|
|
3386
|
-
|
|
3543
|
+
|
|
3387
3544
|
return total;
|
|
3388
3545
|
}
|
|
3389
3546
|
|
|
@@ -3391,16 +3548,16 @@ export class TableRowspangroupingDemo implements OnInit {
|
|
|
3391
3548
|
switch (status) {
|
|
3392
3549
|
case 'unqualified':
|
|
3393
3550
|
return 'danger';
|
|
3394
|
-
|
|
3551
|
+
|
|
3395
3552
|
case 'qualified':
|
|
3396
3553
|
return 'success';
|
|
3397
|
-
|
|
3554
|
+
|
|
3398
3555
|
case 'new':
|
|
3399
3556
|
return 'info';
|
|
3400
|
-
|
|
3557
|
+
|
|
3401
3558
|
case 'negotiation':
|
|
3402
3559
|
return 'warn';
|
|
3403
|
-
|
|
3560
|
+
|
|
3404
3561
|
case 'renewal':
|
|
3405
3562
|
return null;
|
|
3406
3563
|
}
|
|
@@ -3413,12 +3570,12 @@ export class TableRowspangroupingDemo implements OnInit {
|
|
|
3413
3570
|
Table provides onRowSelect and onRowUnselect events to listen selection events.
|
|
3414
3571
|
|
|
3415
3572
|
```typescript
|
|
3416
|
-
import { Component,
|
|
3573
|
+
import { Component, inject, OnInit } from '@angular/core';
|
|
3574
|
+
import { MessageService } from '@exhaustive-ui/core/api';
|
|
3417
3575
|
import { TableModule } from '@exhaustive-ui/core/table';
|
|
3418
3576
|
import { ToastModule } from '@exhaustive-ui/core/toast';
|
|
3419
|
-
import { ProductService } from '@/service/productservice';
|
|
3420
|
-
import { MessageService } from '@exhaustive-ui/core/api';
|
|
3421
3577
|
import { Product } from '@/domain/product';
|
|
3578
|
+
import { ProductService } from '@/service/productservice';
|
|
3422
3579
|
|
|
3423
3580
|
@Component({
|
|
3424
3581
|
template: `
|
|
@@ -3446,12 +3603,14 @@ import { Product } from '@/domain/product';
|
|
|
3446
3603
|
`,
|
|
3447
3604
|
standalone: true,
|
|
3448
3605
|
imports: [TableModule, ToastModule],
|
|
3449
|
-
providers: [
|
|
3606
|
+
providers: [MessageService, ProductService]
|
|
3450
3607
|
})
|
|
3451
3608
|
export class TableSelectioneventsDemo implements OnInit {
|
|
3452
3609
|
private productService = inject(ProductService);
|
|
3453
3610
|
private messageService = inject(MessageService);
|
|
3611
|
+
|
|
3454
3612
|
products!: Product[];
|
|
3613
|
+
|
|
3455
3614
|
selectedProduct!: Product;
|
|
3456
3615
|
|
|
3457
3616
|
ngOnInit() {
|
|
@@ -3475,10 +3634,10 @@ export class TableSelectioneventsDemo implements OnInit {
|
|
|
3475
3634
|
A column can be made sortable by adding the pSortableColumn directive whose value is the field to sort against and a sort indicator via p-sort-icon component. For dynamic columns, setting pSortableColumnDisabled property as true disables sorting for that particular column. Default sorting is executed on a single column, in order to enable multiple field sorting, set sortMode property to "multiple" and use metakey when clicking on another column.
|
|
3476
3635
|
|
|
3477
3636
|
```typescript
|
|
3478
|
-
import { Component,
|
|
3637
|
+
import { Component, inject, OnInit } from '@angular/core';
|
|
3479
3638
|
import { TableModule } from '@exhaustive-ui/core/table';
|
|
3480
|
-
import { ProductService } from '@/service/productservice';
|
|
3481
3639
|
import { Product } from '@/domain/product';
|
|
3640
|
+
import { ProductService } from '@/service/productservice';
|
|
3482
3641
|
|
|
3483
3642
|
@Component({
|
|
3484
3643
|
template: `
|
|
@@ -3529,6 +3688,7 @@ import { Product } from '@/domain/product';
|
|
|
3529
3688
|
})
|
|
3530
3689
|
export class TableSinglecolumnsortDemo implements OnInit {
|
|
3531
3690
|
private productService = inject(ProductService);
|
|
3691
|
+
|
|
3532
3692
|
products!: Product[];
|
|
3533
3693
|
|
|
3534
3694
|
ngOnInit() {
|
|
@@ -3544,12 +3704,12 @@ export class TableSinglecolumnsortDemo implements OnInit {
|
|
|
3544
3704
|
Single row selection is enabled by defining selectionMode as single along with a value binding using selection property. When available, it is suggested to provide a unique identifier of a row with dataKey to optimize performance. By default, metaKey press (e.g. ⌘ ) is necessary to unselect a row however this can be configured with disabling the metaKeySelection property. In touch enabled devices this option has no effect and behavior is same as setting it to false.
|
|
3545
3705
|
|
|
3546
3706
|
```typescript
|
|
3547
|
-
import { Component,
|
|
3707
|
+
import { Component, inject, OnInit } from '@angular/core';
|
|
3548
3708
|
import { FormsModule } from '@angular/forms';
|
|
3549
3709
|
import { TableModule } from '@exhaustive-ui/core/table';
|
|
3550
3710
|
import { ToggleSwitchModule } from '@exhaustive-ui/core/toggleswitch';
|
|
3551
|
-
import { ProductService } from '@/service/productservice';
|
|
3552
3711
|
import { Product } from '@/domain/product';
|
|
3712
|
+
import { ProductService } from '@/service/productservice';
|
|
3553
3713
|
|
|
3554
3714
|
@Component({
|
|
3555
3715
|
template: `
|
|
@@ -3579,13 +3739,16 @@ import { Product } from '@/domain/product';
|
|
|
3579
3739
|
</div>
|
|
3580
3740
|
`,
|
|
3581
3741
|
standalone: true,
|
|
3582
|
-
imports: [TableModule, ToggleSwitchModule
|
|
3742
|
+
imports: [FormsModule, TableModule, ToggleSwitchModule],
|
|
3583
3743
|
providers: [ProductService]
|
|
3584
3744
|
})
|
|
3585
3745
|
export class TableSingleselectionDemo implements OnInit {
|
|
3586
3746
|
private productService = inject(ProductService);
|
|
3747
|
+
|
|
3587
3748
|
products!: Product[];
|
|
3749
|
+
|
|
3588
3750
|
selectedProduct!: Product;
|
|
3751
|
+
|
|
3589
3752
|
metaKey: boolean = true;
|
|
3590
3753
|
|
|
3591
3754
|
ngOnInit() {
|
|
@@ -3601,12 +3764,13 @@ export class TableSingleselectionDemo implements OnInit {
|
|
|
3601
3764
|
In addition to a regular table, alternatives with alternative sizes are available.
|
|
3602
3765
|
|
|
3603
3766
|
```typescript
|
|
3604
|
-
import {
|
|
3767
|
+
import { CommonModule } from '@angular/common';
|
|
3768
|
+
import { Component, inject, OnInit } from '@angular/core';
|
|
3605
3769
|
import { FormsModule } from '@angular/forms';
|
|
3606
3770
|
import { SelectButtonModule } from '@exhaustive-ui/core/selectbutton';
|
|
3607
3771
|
import { TableModule } from '@exhaustive-ui/core/table';
|
|
3608
|
-
import { ProductService } from '@/service/productservice';
|
|
3609
3772
|
import { Product } from '@/domain/product';
|
|
3773
|
+
import { ProductService } from '@/service/productservice';
|
|
3610
3774
|
|
|
3611
3775
|
@Component({
|
|
3612
3776
|
template: `
|
|
@@ -3635,19 +3799,23 @@ import { Product } from '@/domain/product';
|
|
|
3635
3799
|
</div>
|
|
3636
3800
|
`,
|
|
3637
3801
|
standalone: true,
|
|
3638
|
-
imports: [
|
|
3802
|
+
imports: [CommonModule, FormsModule, TableModule, SelectButtonModule],
|
|
3639
3803
|
providers: [ProductService]
|
|
3640
3804
|
})
|
|
3641
3805
|
export class TableSizeDemo implements OnInit {
|
|
3642
3806
|
private productService = inject(ProductService);
|
|
3807
|
+
|
|
3643
3808
|
products!: Product[];
|
|
3809
|
+
|
|
3644
3810
|
sizes!: any[];
|
|
3811
|
+
|
|
3645
3812
|
selectedSize: any = undefined;
|
|
3646
3813
|
|
|
3647
3814
|
ngOnInit() {
|
|
3648
3815
|
this.productService.getProductsMini().then((data) => {
|
|
3649
3816
|
this.products = data;
|
|
3650
3817
|
});
|
|
3818
|
+
|
|
3651
3819
|
this.sizes = [
|
|
3652
3820
|
{ name: 'Small', value: 'small' },
|
|
3653
3821
|
{ name: 'Normal', value: undefined },
|
|
@@ -3662,14 +3830,14 @@ export class TableSizeDemo implements OnInit {
|
|
|
3662
3830
|
Stateful table allows keeping the state such as page, sort and filtering either at local storage or session storage so that when the page is visited again, table would render the data using the last settings. Change the state of the table e.g paginate, navigate away and then return to this table again to test this feature, the setting is set as session with the stateStorage property so that Table retains the state until the browser is closed. Other alternative is local referring to localStorage for an extended lifetime.
|
|
3663
3831
|
|
|
3664
3832
|
```typescript
|
|
3665
|
-
import { Component,
|
|
3833
|
+
import { Component, inject, OnInit } from '@angular/core';
|
|
3666
3834
|
import { IconFieldModule } from '@exhaustive-ui/core/iconfield';
|
|
3667
3835
|
import { InputIconModule } from '@exhaustive-ui/core/inputicon';
|
|
3668
|
-
import { Table, TableModule } from '@exhaustive-ui/core/table';
|
|
3669
|
-
import { TagModule } from '@exhaustive-ui/core/tag';
|
|
3670
3836
|
import { InputTextModule } from '@exhaustive-ui/core/inputtext';
|
|
3837
|
+
import { TableModule } from '@exhaustive-ui/core/table';
|
|
3838
|
+
import { TagModule } from '@exhaustive-ui/core/tag';
|
|
3839
|
+
import { Customer } from '@/domain/customer';
|
|
3671
3840
|
import { CustomerService } from '@/service/customerservice';
|
|
3672
|
-
import { Customer, Representative, Country } from '@/domain/customer';
|
|
3673
3841
|
|
|
3674
3842
|
@Component({
|
|
3675
3843
|
template: `
|
|
@@ -3772,14 +3940,35 @@ import { Customer, Representative, Country } from '@/domain/customer';
|
|
|
3772
3940
|
</div>
|
|
3773
3941
|
`,
|
|
3774
3942
|
standalone: true,
|
|
3775
|
-
imports: [
|
|
3943
|
+
imports: [TableModule, InputTextModule, TagModule, IconFieldModule, InputIconModule],
|
|
3776
3944
|
providers: [CustomerService]
|
|
3777
3945
|
})
|
|
3778
3946
|
export class TableStatefulDemo implements OnInit {
|
|
3779
3947
|
private customerService = inject(CustomerService);
|
|
3948
|
+
|
|
3780
3949
|
customers!: Customer[];
|
|
3950
|
+
|
|
3781
3951
|
selectedCustomers!: Customer;
|
|
3782
3952
|
|
|
3953
|
+
getSeverity(status: string) {
|
|
3954
|
+
switch (status) {
|
|
3955
|
+
case 'unqualified':
|
|
3956
|
+
return 'danger';
|
|
3957
|
+
|
|
3958
|
+
case 'qualified':
|
|
3959
|
+
return 'success';
|
|
3960
|
+
|
|
3961
|
+
case 'new':
|
|
3962
|
+
return 'info';
|
|
3963
|
+
|
|
3964
|
+
case 'negotiation':
|
|
3965
|
+
return 'warn';
|
|
3966
|
+
|
|
3967
|
+
case 'renewal':
|
|
3968
|
+
return null;
|
|
3969
|
+
}
|
|
3970
|
+
}
|
|
3971
|
+
|
|
3783
3972
|
ngOnInit() {
|
|
3784
3973
|
this.customerService.getCustomersSmall().then((data) => {
|
|
3785
3974
|
this.customers = data;
|
|
@@ -3793,10 +3982,10 @@ export class TableStatefulDemo implements OnInit {
|
|
|
3793
3982
|
Alternating rows are displayed when stripedRows property is present.
|
|
3794
3983
|
|
|
3795
3984
|
```typescript
|
|
3796
|
-
import { Component,
|
|
3985
|
+
import { Component, inject, OnInit } from '@angular/core';
|
|
3797
3986
|
import { TableModule } from '@exhaustive-ui/core/table';
|
|
3798
|
-
import { ProductService } from '@/service/productservice';
|
|
3799
3987
|
import { Product } from '@/domain/product';
|
|
3988
|
+
import { ProductService } from '@/service/productservice';
|
|
3800
3989
|
|
|
3801
3990
|
@Component({
|
|
3802
3991
|
template: `
|
|
@@ -3827,6 +4016,7 @@ import { Product } from '@/domain/product';
|
|
|
3827
4016
|
})
|
|
3828
4017
|
export class TableStripedDemo implements OnInit {
|
|
3829
4018
|
private productService = inject(ProductService);
|
|
4019
|
+
|
|
3830
4020
|
products!: Product[];
|
|
3831
4021
|
|
|
3832
4022
|
ngOnInit() {
|
|
@@ -3932,7 +4122,8 @@ import { Component } from '@angular/core';
|
|
|
3932
4122
|
standalone: true,
|
|
3933
4123
|
imports: []
|
|
3934
4124
|
})
|
|
3935
|
-
export class TableStylingDemo {
|
|
4125
|
+
export class TableStylingDemo {
|
|
4126
|
+
}
|
|
3936
4127
|
```
|
|
3937
4128
|
|
|
3938
4129
|
## subheadergrouping-doc
|
|
@@ -3940,11 +4131,11 @@ export class TableStylingDemo {}
|
|
|
3940
4131
|
Rows are grouped with the groupRowsBy property. When rowGroupMode is set as subheader , a header and footer can be displayed for each group. The content of a group header is provided with groupheader and footer with groupfooter templates.
|
|
3941
4132
|
|
|
3942
4133
|
```typescript
|
|
3943
|
-
import { Component,
|
|
4134
|
+
import { Component, inject, OnInit } from '@angular/core';
|
|
3944
4135
|
import { TableModule } from '@exhaustive-ui/core/table';
|
|
3945
4136
|
import { TagModule } from '@exhaustive-ui/core/tag';
|
|
4137
|
+
import { Customer } from '@/domain/customer';
|
|
3946
4138
|
import { CustomerService } from '@/service/customerservice';
|
|
3947
|
-
import { Customer, Country } from '@/domain/customer';
|
|
3948
4139
|
|
|
3949
4140
|
@Component({
|
|
3950
4141
|
template: `
|
|
@@ -4007,6 +4198,7 @@ import { Customer, Country } from '@/domain/customer';
|
|
|
4007
4198
|
})
|
|
4008
4199
|
export class TableSubheadergroupingDemo implements OnInit {
|
|
4009
4200
|
private customerService = inject(CustomerService);
|
|
4201
|
+
|
|
4010
4202
|
customers!: Customer[];
|
|
4011
4203
|
|
|
4012
4204
|
ngOnInit() {
|
|
@@ -4017,7 +4209,7 @@ export class TableSubheadergroupingDemo implements OnInit {
|
|
|
4017
4209
|
|
|
4018
4210
|
calculateCustomerTotal(name: string) {
|
|
4019
4211
|
let total = 0;
|
|
4020
|
-
|
|
4212
|
+
|
|
4021
4213
|
if (this.customers) {
|
|
4022
4214
|
for (let customer of this.customers) {
|
|
4023
4215
|
if (customer.representative?.name === name) {
|
|
@@ -4025,7 +4217,7 @@ export class TableSubheadergroupingDemo implements OnInit {
|
|
|
4025
4217
|
}
|
|
4026
4218
|
}
|
|
4027
4219
|
}
|
|
4028
|
-
|
|
4220
|
+
|
|
4029
4221
|
return total;
|
|
4030
4222
|
}
|
|
4031
4223
|
|
|
@@ -4033,16 +4225,16 @@ export class TableSubheadergroupingDemo implements OnInit {
|
|
|
4033
4225
|
switch (status) {
|
|
4034
4226
|
case 'unqualified':
|
|
4035
4227
|
return 'danger';
|
|
4036
|
-
|
|
4228
|
+
|
|
4037
4229
|
case 'qualified':
|
|
4038
4230
|
return 'success';
|
|
4039
|
-
|
|
4231
|
+
|
|
4040
4232
|
case 'new':
|
|
4041
4233
|
return 'info';
|
|
4042
|
-
|
|
4234
|
+
|
|
4043
4235
|
case 'negotiation':
|
|
4044
4236
|
return 'warn';
|
|
4045
|
-
|
|
4237
|
+
|
|
4046
4238
|
case 'renewal':
|
|
4047
4239
|
return null;
|
|
4048
4240
|
}
|
|
@@ -4055,14 +4247,15 @@ export class TableSubheadergroupingDemo implements OnInit {
|
|
|
4055
4247
|
Custom content at header , body and footer sections are supported via templating.
|
|
4056
4248
|
|
|
4057
4249
|
```typescript
|
|
4058
|
-
import {
|
|
4250
|
+
import { CommonModule } from '@angular/common';
|
|
4059
4251
|
import { FormsModule } from '@angular/forms';
|
|
4252
|
+
import { Component, inject, OnInit } from '@angular/core';
|
|
4060
4253
|
import { ButtonModule } from '@exhaustive-ui/core/button';
|
|
4061
4254
|
import { RatingModule } from '@exhaustive-ui/core/rating';
|
|
4062
4255
|
import { TableModule } from '@exhaustive-ui/core/table';
|
|
4063
4256
|
import { TagModule } from '@exhaustive-ui/core/tag';
|
|
4064
|
-
import { ProductService } from '@/service/productservice';
|
|
4065
4257
|
import { Product } from '@/domain/product';
|
|
4258
|
+
import { ProductService } from '@/service/productservice';
|
|
4066
4259
|
|
|
4067
4260
|
interface Column {
|
|
4068
4261
|
field: string;
|
|
@@ -4112,18 +4305,21 @@ interface Column {
|
|
|
4112
4305
|
</div>
|
|
4113
4306
|
`,
|
|
4114
4307
|
standalone: true,
|
|
4115
|
-
imports: [
|
|
4308
|
+
imports: [CommonModule, FormsModule, ButtonModule, TableModule, RatingModule, TagModule],
|
|
4116
4309
|
providers: [ProductService]
|
|
4117
4310
|
})
|
|
4118
4311
|
export class TableTemplateDemo implements OnInit {
|
|
4119
4312
|
private productService = inject(ProductService);
|
|
4313
|
+
|
|
4120
4314
|
products!: Product[];
|
|
4315
|
+
|
|
4121
4316
|
cols!: Column[];
|
|
4122
4317
|
|
|
4123
4318
|
ngOnInit() {
|
|
4124
4319
|
this.productService.getProductsMini().then((data) => {
|
|
4125
4320
|
this.products = data;
|
|
4126
4321
|
});
|
|
4322
|
+
|
|
4127
4323
|
this.cols = [
|
|
4128
4324
|
{ field: 'code', header: 'Code' },
|
|
4129
4325
|
{ field: 'name', header: 'Name' },
|
|
@@ -4148,13 +4344,16 @@ export class TableTemplateDemo implements OnInit {
|
|
|
4148
4344
|
## verticalscroll-doc
|
|
4149
4345
|
|
|
4150
4346
|
```typescript
|
|
4151
|
-
import { Component,
|
|
4347
|
+
import { Component, inject, OnInit } from '@angular/core';
|
|
4152
4348
|
import { TableModule } from '@exhaustive-ui/core/table';
|
|
4349
|
+
import { Customer } from '@/domain/customer';
|
|
4153
4350
|
import { CustomerService } from '@/service/customerservice';
|
|
4154
|
-
import { Customer, Representative, Country } from '@/domain/customer';
|
|
4155
4351
|
|
|
4156
4352
|
@Component({
|
|
4157
4353
|
template: `
|
|
4354
|
+
<app-docsectiontext>
|
|
4355
|
+
<p>Adding <i>scrollable</i> property along with a <i>scrollHeight</i> for the data viewport enables vertical scrolling with fixed headers.</p></app-docsectiontext
|
|
4356
|
+
>
|
|
4158
4357
|
<div class="card">
|
|
4159
4358
|
<p-table [value]="customers" [scrollable]="true" scrollHeight="400px" [tableStyle]="{ 'min-width': '50rem' }">
|
|
4160
4359
|
<ng-template #header>
|
|
@@ -4182,6 +4381,7 @@ import { Customer, Representative, Country } from '@/domain/customer';
|
|
|
4182
4381
|
})
|
|
4183
4382
|
export class TableVerticalscrollDemo implements OnInit {
|
|
4184
4383
|
private customerService = inject(CustomerService);
|
|
4384
|
+
|
|
4185
4385
|
customers!: Customer[];
|
|
4186
4386
|
|
|
4187
4387
|
ngOnInit() {
|
|
@@ -4194,13 +4394,14 @@ export class TableVerticalscrollDemo implements OnInit {
|
|
|
4194
4394
|
|
|
4195
4395
|
## virtualscroll-doc
|
|
4196
4396
|
|
|
4197
|
-
Virtual Scrolling is an efficient way to render large amount data. Usage is similar to regular scrolling with the addition of
|
|
4397
|
+
Virtual Scrolling is an efficient way to render large amount data. Usage is similar to regular scrolling with the addition of virtualScroll property and virtualScrollItemSize to define a fixed item size. Internally, VirtualScroller component is utilized and further options can be passed with virtualScrollOptions , refer to the API of VirtualScroller for more information about the available options. In this example, 10000 preloaded records are rendered by the Table.
|
|
4198
4398
|
|
|
4199
4399
|
```typescript
|
|
4200
|
-
import {
|
|
4201
|
-
import {
|
|
4202
|
-
import {
|
|
4400
|
+
import { CommonModule } from '@angular/common';
|
|
4401
|
+
import { Component, inject, OnInit } from '@angular/core';
|
|
4402
|
+
import { TableModule } from '@exhaustive-ui/core/table';
|
|
4203
4403
|
import { Car } from '@/domain/car';
|
|
4404
|
+
import { CarService } from '@/service/carservice';
|
|
4204
4405
|
|
|
4205
4406
|
interface Column {
|
|
4206
4407
|
field: string;
|
|
@@ -4229,13 +4430,16 @@ interface Column {
|
|
|
4229
4430
|
</div>
|
|
4230
4431
|
`,
|
|
4231
4432
|
standalone: true,
|
|
4232
|
-
imports: [TableModule],
|
|
4433
|
+
imports: [CommonModule, TableModule],
|
|
4233
4434
|
providers: [CarService]
|
|
4234
4435
|
})
|
|
4235
4436
|
export class TableVirtualscrollDemo implements OnInit {
|
|
4236
4437
|
private carService = inject(CarService);
|
|
4438
|
+
|
|
4237
4439
|
cars!: Car[];
|
|
4440
|
+
|
|
4238
4441
|
virtualCars!: Car[];
|
|
4442
|
+
|
|
4239
4443
|
cols!: Column[];
|
|
4240
4444
|
|
|
4241
4445
|
ngOnInit() {
|
|
@@ -4246,6 +4450,7 @@ export class TableVirtualscrollDemo implements OnInit {
|
|
|
4246
4450
|
{ field: 'brand', header: 'Brand' },
|
|
4247
4451
|
{ field: 'color', header: 'Color' }
|
|
4248
4452
|
];
|
|
4453
|
+
|
|
4249
4454
|
this.cars = Array.from({ length: 10000 }).map((_, i) => this.carService.generateCar(i + 1));
|
|
4250
4455
|
this.virtualCars = Array.from({ length: 10000 });
|
|
4251
4456
|
}
|
|
@@ -4257,12 +4462,12 @@ export class TableVirtualscrollDemo implements OnInit {
|
|
|
4257
4462
|
VirtualScroller is a performance-approach to handle huge data efficiently. Setting virtualScroll property as true and providing a virtualScrollItemSize in pixels would be enough to enable this functionality. It is also suggested to use the same virtualScrollItemSize value on the tr element inside the body template.
|
|
4258
4463
|
|
|
4259
4464
|
```typescript
|
|
4260
|
-
import {
|
|
4465
|
+
import { CommonModule } from '@angular/common';
|
|
4466
|
+
import { Component, inject, OnInit } from '@angular/core';
|
|
4261
4467
|
import { SkeletonModule } from '@exhaustive-ui/core/skeleton';
|
|
4262
|
-
import { TableModule } from '@exhaustive-ui/core/table';
|
|
4263
|
-
import { CarService } from '@/service/carservice';
|
|
4264
|
-
import { TableLazyLoadEvent } from '@exhaustive-ui/core/api';
|
|
4468
|
+
import { TableLazyLoadEvent, TableModule } from '@exhaustive-ui/core/table';
|
|
4265
4469
|
import { Car } from '@/domain/car';
|
|
4470
|
+
import { CarService } from '@/service/carservice';
|
|
4266
4471
|
|
|
4267
4472
|
interface Column {
|
|
4268
4473
|
field: string;
|
|
@@ -4298,13 +4503,16 @@ interface Column {
|
|
|
4298
4503
|
</div>
|
|
4299
4504
|
`,
|
|
4300
4505
|
standalone: true,
|
|
4301
|
-
imports: [
|
|
4506
|
+
imports: [CommonModule, TableModule, SkeletonModule],
|
|
4302
4507
|
providers: [CarService]
|
|
4303
4508
|
})
|
|
4304
4509
|
export class TableVirtualscrolllazyDemo implements OnInit {
|
|
4305
4510
|
private carService = inject(CarService);
|
|
4511
|
+
|
|
4306
4512
|
cars!: Car[];
|
|
4513
|
+
|
|
4307
4514
|
virtualCars!: Car[];
|
|
4515
|
+
|
|
4308
4516
|
cols!: Column[];
|
|
4309
4517
|
|
|
4310
4518
|
ngOnInit() {
|
|
@@ -4315,6 +4523,7 @@ export class TableVirtualscrolllazyDemo implements OnInit {
|
|
|
4315
4523
|
{ field: 'brand', header: 'Brand' },
|
|
4316
4524
|
{ field: 'color', header: 'Color' }
|
|
4317
4525
|
];
|
|
4526
|
+
|
|
4318
4527
|
this.cars = Array.from({ length: 10000 }).map((_, i) => this.carService.generateCar(i + 1));
|
|
4319
4528
|
this.virtualCars = Array.from({ length: 10000 });
|
|
4320
4529
|
}
|
|
@@ -4325,10 +4534,10 @@ export class TableVirtualscrolllazyDemo implements OnInit {
|
|
|
4325
4534
|
() => {
|
|
4326
4535
|
//load data of required page
|
|
4327
4536
|
let loadedCars = this.cars.slice(event.first, event.first + event.rows);
|
|
4328
|
-
|
|
4537
|
+
|
|
4329
4538
|
//populate page of virtual cars
|
|
4330
4539
|
Array.prototype.splice.apply(this.virtualCars, [...[event.first, event.rows], ...loadedCars]);
|
|
4331
|
-
|
|
4540
|
+
|
|
4332
4541
|
//trigger change detection
|
|
4333
4542
|
event.forceUpdate();
|
|
4334
4543
|
},
|
|
@@ -4346,90 +4555,90 @@ Table displays data in tabular format.
|
|
|
4346
4555
|
|
|
4347
4556
|
| Name | Type | Default | Description |
|
|
4348
4557
|
|------|------|---------|-------------|
|
|
4349
|
-
| dt |
|
|
4350
|
-
| unstyled |
|
|
4351
|
-
| pt |
|
|
4352
|
-
| ptOptions |
|
|
4353
|
-
| frozenValue |
|
|
4354
|
-
| tableStyle |
|
|
4355
|
-
| tableStyleClass |
|
|
4356
|
-
| paginator |
|
|
4357
|
-
| pageLinks |
|
|
4358
|
-
| rowsPerPageOptions |
|
|
4359
|
-
| alwaysShowPaginator |
|
|
4360
|
-
| paginatorPosition |
|
|
4361
|
-
| paginatorStyleClass |
|
|
4362
|
-
| paginatorDropdownAppendTo |
|
|
4363
|
-
| paginatorDropdownScrollHeight |
|
|
4364
|
-
| currentPageReportTemplate |
|
|
4365
|
-
| showCurrentPageReport |
|
|
4366
|
-
| showJumpToPageDropdown |
|
|
4367
|
-
| showJumpToPageInput |
|
|
4368
|
-
| showFirstLastIcon |
|
|
4369
|
-
| showPageLinks |
|
|
4370
|
-
| defaultSortOrder |
|
|
4371
|
-
| sortMode |
|
|
4372
|
-
| resetPageOnSort |
|
|
4373
|
-
| selectionMode |
|
|
4374
|
-
| selectionPageOnly |
|
|
4375
|
-
| contextMenuSelection |
|
|
4376
|
-
| contextMenuSelectionMode |
|
|
4377
|
-
| dataKey |
|
|
4378
|
-
| metaKeySelection |
|
|
4379
|
-
| rowSelectable |
|
|
4380
|
-
| rowTrackBy |
|
|
4381
|
-
| lazy |
|
|
4382
|
-
| lazyLoadOnInit |
|
|
4383
|
-
| compareSelectionBy |
|
|
4384
|
-
| csvSeparator |
|
|
4385
|
-
| exportFilename |
|
|
4386
|
-
| filters |
|
|
4387
|
-
| globalFilterFields |
|
|
4388
|
-
| filterDelay |
|
|
4389
|
-
| filterLocale |
|
|
4390
|
-
| expandedRowKeys |
|
|
4391
|
-
| editingRowKeys |
|
|
4392
|
-
| rowExpandMode |
|
|
4393
|
-
| scrollable |
|
|
4394
|
-
| rowGroupMode |
|
|
4395
|
-
| scrollHeight |
|
|
4396
|
-
| virtualScroll |
|
|
4397
|
-
| virtualScrollItemSize |
|
|
4398
|
-
| virtualScrollOptions |
|
|
4399
|
-
| virtualScrollDelay |
|
|
4400
|
-
| contextMenu |
|
|
4401
|
-
| resizableColumns |
|
|
4402
|
-
| columnResizeMode |
|
|
4403
|
-
| reorderableColumns |
|
|
4404
|
-
| loading |
|
|
4405
|
-
| loadingIcon |
|
|
4406
|
-
| showLoader |
|
|
4407
|
-
| rowHover |
|
|
4408
|
-
| customSort |
|
|
4409
|
-
| showInitialSortBadge |
|
|
4410
|
-
| exportFunction |
|
|
4411
|
-
| exportHeader |
|
|
4412
|
-
| stateKey |
|
|
4413
|
-
| stateStorage |
|
|
4414
|
-
| editMode |
|
|
4415
|
-
| groupRowsBy |
|
|
4416
|
-
| size |
|
|
4417
|
-
| showGridlines |
|
|
4418
|
-
| stripedRows |
|
|
4419
|
-
| groupRowsByOrder |
|
|
4420
|
-
| responsiveLayout |
|
|
4421
|
-
| breakpoint |
|
|
4422
|
-
| paginatorLocale |
|
|
4423
|
-
| value |
|
|
4424
|
-
| columns |
|
|
4425
|
-
| first |
|
|
4426
|
-
| rows |
|
|
4427
|
-
| totalRecords |
|
|
4428
|
-
| sortField |
|
|
4429
|
-
| sortOrder |
|
|
4430
|
-
| multiSortMeta |
|
|
4431
|
-
| selection |
|
|
4432
|
-
| selectAll |
|
|
4558
|
+
| dt | Object | undefined | Defines scoped design tokens of the component. |
|
|
4559
|
+
| unstyled | boolean | undefined | Indicates whether the component should be rendered without styles. |
|
|
4560
|
+
| pt | TablePassThrough | undefined | Used to pass attributes to DOM elements inside the component. |
|
|
4561
|
+
| ptOptions | PassThroughOptions | undefined | Used to configure passthrough(pt) options of the component. |
|
|
4562
|
+
| frozenValue | any[] | - | An array of objects to display as frozen. |
|
|
4563
|
+
| tableStyle | { [klass: string]: any } | - | Inline style of the table. |
|
|
4564
|
+
| tableStyleClass | string | - | Style class of the table. |
|
|
4565
|
+
| paginator | boolean | - | When specified as true, enables the pagination. |
|
|
4566
|
+
| pageLinks | number | 5 | Number of page links to display in paginator. |
|
|
4567
|
+
| rowsPerPageOptions | any[] | - | Array of integer/object values to display inside rows per page dropdown of paginator |
|
|
4568
|
+
| alwaysShowPaginator | boolean | true | Whether to show it even there is only one page. |
|
|
4569
|
+
| paginatorPosition | "top" \| "bottom" \| "both" | 'bottom' | Position of the paginator, options are "top", "bottom" or "both". |
|
|
4570
|
+
| paginatorStyleClass | string | - | Custom style class for paginator |
|
|
4571
|
+
| paginatorDropdownAppendTo | any | - | Target element to attach the paginator dropdown overlay, valid values are "body" or a local ng-template variable of another element (note: use binding with brackets for template variables, e.g. [appendTo]="mydiv" for a div element having #mydiv as variable name). |
|
|
4572
|
+
| paginatorDropdownScrollHeight | string | '200px' | Paginator dropdown height of the viewport in pixels, a scrollbar is defined if height of list exceeds this value. |
|
|
4573
|
+
| currentPageReportTemplate | string | '{currentPage} of {totalPages}' | Template of the current page report element. Available placeholders are {currentPage},{totalPages},{rows},{first},{last} and {totalRecords} |
|
|
4574
|
+
| showCurrentPageReport | boolean | - | Whether to display current page report. |
|
|
4575
|
+
| showJumpToPageDropdown | boolean | - | Whether to display a dropdown to navigate to any page. |
|
|
4576
|
+
| showJumpToPageInput | boolean | - | Whether to display a input to navigate to any page. |
|
|
4577
|
+
| showFirstLastIcon | boolean | true | When enabled, icons are displayed on paginator to go first and last page. |
|
|
4578
|
+
| showPageLinks | boolean | true | Whether to show page links. |
|
|
4579
|
+
| defaultSortOrder | number | 1 | Sort order to use when an unsorted column gets sorted by user interaction. |
|
|
4580
|
+
| sortMode | "multiple" \| "single" | 'single' | Defines whether sorting works on single column or on multiple columns. |
|
|
4581
|
+
| resetPageOnSort | boolean | true | When true, resets paginator to first page after sorting. Available only when sortMode is set to single. |
|
|
4582
|
+
| selectionMode | "multiple" \| "single" | - | Specifies the selection mode, valid values are "single" and "multiple". |
|
|
4583
|
+
| selectionPageOnly | boolean | - | When enabled with paginator and checkbox selection mode, the select all checkbox in the header will select all rows on the current page. |
|
|
4584
|
+
| contextMenuSelection | any | - | Selected row with a context menu, supports one or two-way binding. Emits `contextMenuSelectionChange` with the row data on context menu selection change. |
|
|
4585
|
+
| contextMenuSelectionMode | string | 'separate' | Defines the behavior of context menu selection, in "separate" mode context menu updates contextMenuSelection property whereas in joint mode selection property is used instead so that when row selection is enabled, both row selection and context menu selection use the same property. |
|
|
4586
|
+
| dataKey | string | - | A property to uniquely identify a record in data. |
|
|
4587
|
+
| metaKeySelection | boolean | false | Defines whether metaKey should be considered for the selection. On touch enabled devices, metaKeySelection is turned off automatically. |
|
|
4588
|
+
| rowSelectable | (row: { data: any; index: number }) => boolean | - | Defines if the row is selectable. |
|
|
4589
|
+
| rowTrackBy | Function | (index: number, item: any) => item | Function to optimize the dom operations by delegating to ngForTrackBy, default algorithm checks for object identity. |
|
|
4590
|
+
| lazy | boolean | false | Defines if data is loaded and interacted with in lazy manner. |
|
|
4591
|
+
| lazyLoadOnInit | boolean | true | Whether to call lazy loading on initialization. |
|
|
4592
|
+
| compareSelectionBy | "equals" \| "deepEquals" | 'deepEquals' | Algorithm to define if a row is selected, valid values are "equals" that compares by reference and "deepEquals" that compares all fields. |
|
|
4593
|
+
| csvSeparator | string | ',' | Character to use as the csv separator. |
|
|
4594
|
+
| exportFilename | string | 'download' | Name of the exported file. |
|
|
4595
|
+
| filters | { [s: string]: FilterMetadata \| FilterMetadata[] } | {} | An array of FilterMetadata objects to provide external filters. |
|
|
4596
|
+
| globalFilterFields | string[] | - | An array of fields as string to use in global filtering. |
|
|
4597
|
+
| filterDelay | number | 300 | Delay in milliseconds before filtering the data. |
|
|
4598
|
+
| filterLocale | string | - | Locale to use in filtering. The default locale is the host environment's current locale. |
|
|
4599
|
+
| expandedRowKeys | { [s: string]: boolean } | {} | Map instance to keep the expanded rows where key of the map is the data key of the row. |
|
|
4600
|
+
| editingRowKeys | { [s: string]: boolean } | {} | Map instance to keep the rows being edited where key of the map is the data key of the row. |
|
|
4601
|
+
| rowExpandMode | "multiple" \| "single" | 'multiple' | Whether multiple rows can be expanded at any time. Valid values are "multiple" and "single". |
|
|
4602
|
+
| scrollable | boolean | - | Enables scrollable tables. |
|
|
4603
|
+
| rowGroupMode | "subheader" \| "rowspan" | - | Type of the row grouping, valid values are "subheader" and "rowspan". |
|
|
4604
|
+
| scrollHeight | string | - | Height of the scroll viewport in fixed pixels or the "flex" keyword for a dynamic size. |
|
|
4605
|
+
| virtualScroll | boolean | - | Whether the data should be loaded on demand during scroll. |
|
|
4606
|
+
| virtualScrollItemSize | number | - | Height of a row to use in calculations of virtual scrolling. |
|
|
4607
|
+
| virtualScrollOptions | ScrollerOptions | - | Whether to use the scroller feature. The properties of scroller component can be used like an object in it. |
|
|
4608
|
+
| virtualScrollDelay | number | 250 | Threshold in milliseconds to delay lazy loading during scrolling. |
|
|
4609
|
+
| contextMenu | any | - | Local ng-template varilable of a ContextMenu. |
|
|
4610
|
+
| resizableColumns | boolean | - | When enabled, columns can be resized using drag and drop. |
|
|
4611
|
+
| columnResizeMode | string | 'fit' | Defines whether the overall table width should change on column resize, valid values are "fit" and "expand". |
|
|
4612
|
+
| reorderableColumns | boolean | - | When enabled, columns can be reordered using drag and drop. |
|
|
4613
|
+
| loading | boolean | - | Displays a loader to indicate data load is in progress. |
|
|
4614
|
+
| loadingIcon | string | - | The icon to show while indicating data load is in progress. |
|
|
4615
|
+
| showLoader | boolean | true | Whether to show the loading mask when loading property is true. |
|
|
4616
|
+
| rowHover | boolean | - | Adds hover effect to rows without the need for selectionMode. Note that tr elements that can be hovered need to have "p-selectable-row" class for rowHover to work. |
|
|
4617
|
+
| customSort | boolean | - | Whether to use the default sorting or a custom one using sortFunction. |
|
|
4618
|
+
| showInitialSortBadge | boolean | true | Whether to use the initial sort badge or not. |
|
|
4619
|
+
| exportFunction | Function | - | Export function. |
|
|
4620
|
+
| exportHeader | string | - | Custom export header of the column to be exported as CSV. |
|
|
4621
|
+
| stateKey | string | - | Unique identifier of a stateful table to use in state storage. |
|
|
4622
|
+
| stateStorage | "session" \| "local" | 'session' | Defines where a stateful table keeps its state, valid values are "session" for sessionStorage and "local" for localStorage. |
|
|
4623
|
+
| editMode | "row" \| "cell" | 'cell' | Defines the editing mode, valid values are "cell" and "row". |
|
|
4624
|
+
| groupRowsBy | any | - | Field name to use in row grouping. |
|
|
4625
|
+
| size | "small" \| "large" | - | Defines the size of the table. |
|
|
4626
|
+
| showGridlines | boolean | - | Whether to show grid lines between cells. |
|
|
4627
|
+
| stripedRows | boolean | - | Whether to display rows with alternating colors. |
|
|
4628
|
+
| groupRowsByOrder | number | 1 | Order to sort when default row grouping is enabled. |
|
|
4629
|
+
| responsiveLayout | string | 'scroll' | Defines the responsive mode, valid options are "stack" and "scroll". **(Deprecated)** |
|
|
4630
|
+
| breakpoint | string | '960px' | The breakpoint to define the maximum width boundary when using stack responsive layout. |
|
|
4631
|
+
| paginatorLocale | string | - | Locale to be used in paginator formatting. |
|
|
4632
|
+
| value | RowData[] | [] | An array of objects to display. |
|
|
4633
|
+
| columns | any[] | - | An array of objects to represent dynamic columns. |
|
|
4634
|
+
| first | number | 0 | Index of the first row to be displayed, supports one or two-way binding. Emits `firstChange` with the first element on pagination. |
|
|
4635
|
+
| rows | number | - | Number of rows to display per page, supports one or two-way binding. Emits `rowsChange` with the row count on rows change. |
|
|
4636
|
+
| totalRecords | number | 0 | Number of total records, defaults to length of value when not defined. |
|
|
4637
|
+
| sortField | string | - | Name of the field to sort data by default. |
|
|
4638
|
+
| sortOrder | number | 1 | Order to sort when default sorting is enabled. |
|
|
4639
|
+
| multiSortMeta | SortMeta[] | - | An array of SortMeta objects to sort the data by default in multiple sort mode. |
|
|
4640
|
+
| selection | any | - | Selected row in single mode or an array of values in multiple mode, supports one or two-way binding. Emits `selectionChange` with the selected data on selection change. |
|
|
4641
|
+
| selectAll | boolean | - | Whether all data is selected. |
|
|
4433
4642
|
|
|
4434
4643
|
### Emits
|
|
4435
4644
|
|