@exhaustive-ui/mcp 0.0.0-stage → 3.0.0-alpha.1
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/LICENSE +23 -0
- package/README.md +167 -2
- package/data/components/accordion.md +421 -0
- package/data/components/animateonscroll.md +163 -0
- package/data/components/autocomplete.md +1077 -0
- package/data/components/autofocus.md +38 -0
- package/data/components/avatar.md +417 -0
- package/data/components/badge.md +234 -0
- package/data/components/blockui.md +108 -0
- package/data/components/breadcrumb.md +178 -0
- package/data/components/button.md +774 -0
- package/data/components/card.md +138 -0
- package/data/components/carousel.md +440 -0
- package/data/components/cascadeselect.md +1387 -0
- package/data/components/chart.md +1178 -0
- package/data/components/checkbox.md +529 -0
- package/data/components/chip.md +180 -0
- package/data/components/colorpicker.md +301 -0
- package/data/components/confirmdialog.md +287 -0
- package/data/components/confirmpopup.md +417 -0
- package/data/components/contextmenu.md +491 -0
- package/data/components/dataview.md +600 -0
- package/data/components/datepicker.md +1262 -0
- package/data/components/dialog.md +622 -0
- package/data/components/divider.md +250 -0
- package/data/components/dock.md +500 -0
- package/data/components/dragdrop.md +285 -0
- package/data/components/drawer.md +510 -0
- package/data/components/dynamicdialog.md +109 -0
- package/data/components/editor.md +291 -0
- package/data/components/fieldset.md +182 -0
- package/data/components/fileupload.md +430 -0
- package/data/components/floatlabel.md +155 -0
- package/data/components/fluid.md +72 -0
- package/data/components/focustrap.md +65 -0
- package/data/components/galleria.md +627 -0
- package/data/components/iconfield.md +246 -0
- package/data/components/iftalabel.md +105 -0
- package/data/components/imagecompare.md +97 -0
- package/data/components/inplace.md +233 -0
- package/data/components/inputgroup.md +306 -0
- package/data/components/inputmask.md +518 -0
- package/data/components/inputnumber.md +675 -0
- package/data/components/inputotp.md +336 -0
- package/data/components/inputtext.md +488 -0
- package/data/components/keyfilter.md +85 -0
- package/data/components/knob.md +462 -0
- package/data/components/listbox.md +798 -0
- package/data/components/llms.md +28 -0
- package/data/components/megamenu.md +587 -0
- package/data/components/menu.md +483 -0
- package/data/components/menubar.md +462 -0
- package/data/components/message.md +449 -0
- package/data/components/metergroup.md +241 -0
- package/data/components/multiselect.md +1047 -0
- package/data/components/orderlist.md +342 -0
- package/data/components/organizationchart.md +197 -0
- package/data/components/overlay.md +217 -0
- package/data/components/paginator.md +314 -0
- package/data/components/panel.md +214 -0
- package/data/components/panelmenu.md +699 -0
- package/data/components/password.md +570 -0
- package/data/components/picklist.md +420 -0
- package/data/components/popover.md +378 -0
- package/data/components/progressbar.md +181 -0
- package/data/components/progressspinner.md +91 -0
- package/data/components/radiobutton.md +377 -0
- package/data/components/rating.md +312 -0
- package/data/components/ripple.md +89 -0
- package/data/components/scroller.md +122 -0
- package/data/components/scrollpanel.md +149 -0
- package/data/components/scrolltop.md +105 -0
- package/data/components/select.md +1206 -0
- package/data/components/selectbutton.md +356 -0
- package/data/components/skeleton.md +242 -0
- package/data/components/slider.md +337 -0
- package/data/components/speeddial.md +589 -0
- package/data/components/splitbutton.md +945 -0
- package/data/components/splitter.md +196 -0
- package/data/components/stepper.md +411 -0
- package/data/components/styleclass.md +126 -0
- package/data/components/table.md +4557 -0
- package/data/components/tabs.md +467 -0
- package/data/components/tag.md +200 -0
- package/data/components/terminal.md +118 -0
- package/data/components/textarea.md +416 -0
- package/data/components/tieredmenu.md +578 -0
- package/data/components/timeline.md +310 -0
- package/data/components/toast.md +596 -0
- package/data/components/togglebutton.md +356 -0
- package/data/components/toggleswitch.md +285 -0
- package/data/components/toolbar.md +182 -0
- package/data/components/tooltip.md +211 -0
- package/data/components/tree.md +746 -0
- package/data/components/treeselect.md +912 -0
- package/data/components/treetable.md +2814 -0
- package/data/components.json +43751 -0
- package/data/llms-full.txt +47433 -0
- package/data/llms.txt +121 -0
- package/data/manifest.json +46513 -0
- package/data/pages/accessibility.md +28 -0
- package/data/pages/animations.md +28 -0
- package/data/pages/configuration.md +210 -0
- package/data/pages/contribution.md +20 -0
- package/data/pages/customicons.md +20 -0
- package/data/pages/faq.md +20 -0
- package/data/pages/icons.md +66 -0
- package/data/pages/installation.md +71 -0
- package/data/pages/llms.md +61 -0
- package/data/pages/passthrough.md +32 -0
- package/data/pages/philosophy.md +28 -0
- package/data/pages/primeflex.md +20 -0
- package/data/pages/rtl.md +12 -0
- package/data/pages/styled.md +132 -0
- package/data/pages/tailwind.md +40 -0
- package/data/pages/unstyled.md +39 -0
- package/data/snapshot.json +9 -0
- package/dist/index.d.mts +448 -0
- package/dist/index.mjs +2501 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +67 -3
|
@@ -0,0 +1,4557 @@
|
|
|
1
|
+
# Angular Table Component
|
|
2
|
+
|
|
3
|
+
Table displays data in tabular format.
|
|
4
|
+
|
|
5
|
+
## Accessibility
|
|
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. filterInputProps of the Column component can be used to define aria labels for the built-in filter components, 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 . 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.
|
|
8
|
+
|
|
9
|
+
## Basic
|
|
10
|
+
|
|
11
|
+
DataTable requires a collection to display along with column components for the representation of the data.
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { Component, OnInit, inject } from '@angular/core';
|
|
15
|
+
import { Table, TableModule } from '@exhaustive-ui/core/table';
|
|
16
|
+
import { ProductService } from '@/service/productservice';
|
|
17
|
+
import { Product } from '@/domain/product';
|
|
18
|
+
|
|
19
|
+
@Component({
|
|
20
|
+
template: `
|
|
21
|
+
<div class="card">
|
|
22
|
+
<p-table [value]="products" [tableStyle]="{ 'min-width': '50rem' }">
|
|
23
|
+
<ng-template #header>
|
|
24
|
+
<tr>
|
|
25
|
+
<th>Code</th>
|
|
26
|
+
<th>Name</th>
|
|
27
|
+
<th>Category</th>
|
|
28
|
+
<th>Quantity</th>
|
|
29
|
+
</tr>
|
|
30
|
+
</ng-template>
|
|
31
|
+
<ng-template #body let-product>
|
|
32
|
+
<tr>
|
|
33
|
+
<td>{{ product.code }}</td>
|
|
34
|
+
<td>{{ product.name }}</td>
|
|
35
|
+
<td>{{ product.category }}</td>
|
|
36
|
+
<td>{{ product.quantity }}</td>
|
|
37
|
+
</tr>
|
|
38
|
+
</ng-template>
|
|
39
|
+
</p-table>
|
|
40
|
+
</div>
|
|
41
|
+
`,
|
|
42
|
+
standalone: true,
|
|
43
|
+
imports: [TableModule],
|
|
44
|
+
providers: [ProductService]
|
|
45
|
+
})
|
|
46
|
+
export class TableBasicDemo implements OnInit {
|
|
47
|
+
private productService = inject(ProductService);
|
|
48
|
+
products!: Product[];
|
|
49
|
+
|
|
50
|
+
ngOnInit() {
|
|
51
|
+
this.productService.getProductsMini().then((data) => {
|
|
52
|
+
this.products = data;
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## celledit-doc
|
|
59
|
+
|
|
60
|
+
In-cell editing is enabled by adding pEditableColumn directive to an editable cell that has a p-cellEditor helper component to define the input-output templates for the edit and view modes respectively.
|
|
61
|
+
|
|
62
|
+
```typescript
|
|
63
|
+
import { Component, OnInit, inject } from '@angular/core';
|
|
64
|
+
import { FormsModule } from '@angular/forms';
|
|
65
|
+
import { TableModule } from '@exhaustive-ui/core/table';
|
|
66
|
+
import { InputTextModule } from '@exhaustive-ui/core/inputtext';
|
|
67
|
+
import { ProductService } from '@/service/productservice';
|
|
68
|
+
import { Product } from '@/domain/product';
|
|
69
|
+
|
|
70
|
+
@Component({
|
|
71
|
+
template: `
|
|
72
|
+
<div class="card">
|
|
73
|
+
<p-table [value]="products" dataKey="id" [tableStyle]="{ 'min-width': '50rem' }">
|
|
74
|
+
<ng-template #header>
|
|
75
|
+
<tr>
|
|
76
|
+
<th style="width:25%">Code</th>
|
|
77
|
+
<th style="width:25%">Name</th>
|
|
78
|
+
<th style="width:25%">Quantity</th>
|
|
79
|
+
<th style="width:25%">Price</th>
|
|
80
|
+
</tr>
|
|
81
|
+
</ng-template>
|
|
82
|
+
<ng-template #body let-product let-editing="editing">
|
|
83
|
+
<tr>
|
|
84
|
+
<td [pEditableColumn]="product.code" pEditableColumnField="code">
|
|
85
|
+
<p-cellEditor>
|
|
86
|
+
<ng-template #input>
|
|
87
|
+
<input pInputText type="text" [(ngModel)]="product.code" fluid />
|
|
88
|
+
</ng-template>
|
|
89
|
+
<ng-template #output>
|
|
90
|
+
{{ product.code }}
|
|
91
|
+
</ng-template>
|
|
92
|
+
</p-cellEditor>
|
|
93
|
+
</td>
|
|
94
|
+
<td [pEditableColumn]="product.name" pEditableColumnField="name">
|
|
95
|
+
<p-cellEditor>
|
|
96
|
+
<ng-template #input>
|
|
97
|
+
<input pInputText type="text" [(ngModel)]="product.name" required fluid />
|
|
98
|
+
</ng-template>
|
|
99
|
+
<ng-template #output>
|
|
100
|
+
{{ product.name }}
|
|
101
|
+
</ng-template>
|
|
102
|
+
</p-cellEditor>
|
|
103
|
+
</td>
|
|
104
|
+
<td [pEditableColumn]="product.quantity" pEditableColumnField="quantity">
|
|
105
|
+
<p-cellEditor>
|
|
106
|
+
<ng-template #input>
|
|
107
|
+
<input pInputText [(ngModel)]="product.quantity" fluid />
|
|
108
|
+
</ng-template>
|
|
109
|
+
<ng-template #output>
|
|
110
|
+
{{ product.quantity }}
|
|
111
|
+
</ng-template>
|
|
112
|
+
</p-cellEditor>
|
|
113
|
+
</td>
|
|
114
|
+
<td [pEditableColumn]="product.price" pEditableColumnField="price">
|
|
115
|
+
<p-cellEditor>
|
|
116
|
+
<ng-template #input>
|
|
117
|
+
<input pInputText type="text" [(ngModel)]="product.price" fluid />
|
|
118
|
+
</ng-template>
|
|
119
|
+
<ng-template #output>
|
|
120
|
+
{{ product.price | currency: 'USD' }}
|
|
121
|
+
</ng-template>
|
|
122
|
+
</p-cellEditor>
|
|
123
|
+
</td>
|
|
124
|
+
</tr>
|
|
125
|
+
</ng-template>
|
|
126
|
+
</p-table>
|
|
127
|
+
</div>
|
|
128
|
+
`,
|
|
129
|
+
standalone: true,
|
|
130
|
+
imports: [TableModule, InputTextModule, FormsModule],
|
|
131
|
+
providers: [ProductService]
|
|
132
|
+
})
|
|
133
|
+
export class TableCelleditDemo implements OnInit {
|
|
134
|
+
private productService = inject(ProductService);
|
|
135
|
+
products!: Product[];
|
|
136
|
+
|
|
137
|
+
ngOnInit() {
|
|
138
|
+
this.productService.getProductsMini().then((data) => {
|
|
139
|
+
this.products = data;
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## checkboxselection-doc
|
|
146
|
+
|
|
147
|
+
Multiple selection can also be handled using checkboxes by enabling the selectionMode property of column as multiple .
|
|
148
|
+
|
|
149
|
+
```typescript
|
|
150
|
+
import { Component, OnInit, inject } from '@angular/core';
|
|
151
|
+
import { TableModule } from '@exhaustive-ui/core/table';
|
|
152
|
+
import { ProductService } from '@/service/productservice';
|
|
153
|
+
import { Product } from '@/domain/product';
|
|
154
|
+
|
|
155
|
+
@Component({
|
|
156
|
+
template: `
|
|
157
|
+
<div class="card">
|
|
158
|
+
<p-table [value]="products" [(selection)]="selectedProducts" dataKey="code" [tableStyle]="{ 'min-width': '50rem' }">
|
|
159
|
+
<ng-template #header>
|
|
160
|
+
<tr>
|
|
161
|
+
<th style="width: 4rem">
|
|
162
|
+
<p-tableHeaderCheckbox />
|
|
163
|
+
</th>
|
|
164
|
+
<th>Code</th>
|
|
165
|
+
<th>Name</th>
|
|
166
|
+
<th>Category</th>
|
|
167
|
+
<th>Quantity</th>
|
|
168
|
+
</tr>
|
|
169
|
+
</ng-template>
|
|
170
|
+
<ng-template #body let-product>
|
|
171
|
+
<tr>
|
|
172
|
+
<td>
|
|
173
|
+
<p-tableCheckbox [value]="product" />
|
|
174
|
+
</td>
|
|
175
|
+
<td>{{ product.code }}</td>
|
|
176
|
+
<td>{{ product.name }}</td>
|
|
177
|
+
<td>{{ product.category }}</td>
|
|
178
|
+
<td>{{ product.quantity }}</td>
|
|
179
|
+
</tr>
|
|
180
|
+
</ng-template>
|
|
181
|
+
</p-table>
|
|
182
|
+
</div>
|
|
183
|
+
`,
|
|
184
|
+
standalone: true,
|
|
185
|
+
imports: [TableModule],
|
|
186
|
+
providers: [ProductService]
|
|
187
|
+
})
|
|
188
|
+
export class TableCheckboxselectionDemo implements OnInit {
|
|
189
|
+
private productService = inject(ProductService);
|
|
190
|
+
products!: Product[];
|
|
191
|
+
selectedProducts!: Product;
|
|
192
|
+
|
|
193
|
+
ngOnInit() {
|
|
194
|
+
this.productService.getProductsMini().then((data) => {
|
|
195
|
+
this.products = data;
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
## columngroup-doc
|
|
202
|
+
|
|
203
|
+
Columns can be grouped using rowspan and colspan properties.
|
|
204
|
+
|
|
205
|
+
```typescript
|
|
206
|
+
import { Component, OnInit } from '@angular/core';
|
|
207
|
+
import { TableModule } from '@exhaustive-ui/core/table';
|
|
208
|
+
import { Product } from '@/domain/product';
|
|
209
|
+
|
|
210
|
+
@Component({
|
|
211
|
+
template: `
|
|
212
|
+
<div class="card">
|
|
213
|
+
<p-table [value]="sales" [tableStyle]="{ 'min-width': '50rem' }">
|
|
214
|
+
<ng-template #header>
|
|
215
|
+
<tr>
|
|
216
|
+
<th rowspan="3">Product</th>
|
|
217
|
+
<th colspan="4">Sale Rate</th>
|
|
218
|
+
</tr>
|
|
219
|
+
<tr>
|
|
220
|
+
<th colspan="2">Sales</th>
|
|
221
|
+
<th colspan="2">Profits</th>
|
|
222
|
+
</tr>
|
|
223
|
+
<tr>
|
|
224
|
+
<th>Last Year</th>
|
|
225
|
+
<th>This Year</th>
|
|
226
|
+
<th>Last Year</th>
|
|
227
|
+
<th>This Year</th>
|
|
228
|
+
</tr>
|
|
229
|
+
</ng-template>
|
|
230
|
+
<ng-template #body let-sale>
|
|
231
|
+
<tr>
|
|
232
|
+
<td>{{ sale.product }}</td>
|
|
233
|
+
<td>{{ sale.lastYearSale }}%</td>
|
|
234
|
+
<td>{{ sale.thisYearSale }}%</td>
|
|
235
|
+
<td>{{ sale.lastYearProfit | currency: 'USD' }}</td>
|
|
236
|
+
<td>{{ sale.thisYearProfit | currency: 'USD' }}</td>
|
|
237
|
+
</tr>
|
|
238
|
+
</ng-template>
|
|
239
|
+
<ng-template #footer>
|
|
240
|
+
<tr>
|
|
241
|
+
<td colspan="3" class="text-right font-bold p-3 pb-0">Totals</td>
|
|
242
|
+
<td class="font-bold p-3 pb-0">{{ lastYearTotal | currency: 'USD' }}</td>
|
|
243
|
+
<td class="font-bold p-3 pb-0">{{ thisYearTotal | currency: 'USD' }}</td>
|
|
244
|
+
</tr>
|
|
245
|
+
</ng-template>
|
|
246
|
+
</p-table>
|
|
247
|
+
</div>
|
|
248
|
+
`,
|
|
249
|
+
standalone: true,
|
|
250
|
+
imports: [TableModule]
|
|
251
|
+
})
|
|
252
|
+
export class TableColumngroupDemo implements OnInit {
|
|
253
|
+
sales!: any[];
|
|
254
|
+
lastYearTotal!: number;
|
|
255
|
+
thisYearTotal!: number;
|
|
256
|
+
|
|
257
|
+
ngOnInit() {
|
|
258
|
+
this.sales = [
|
|
259
|
+
{
|
|
260
|
+
product: 'Bamboo Watch',
|
|
261
|
+
lastYearSale: 51,
|
|
262
|
+
thisYearSale: 40,
|
|
263
|
+
lastYearProfit: 54406,
|
|
264
|
+
thisYearProfit: 43342
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
product: 'Black Watch',
|
|
268
|
+
lastYearSale: 83,
|
|
269
|
+
thisYearSale: 9,
|
|
270
|
+
lastYearProfit: 423132,
|
|
271
|
+
thisYearProfit: 312122
|
|
272
|
+
},
|
|
273
|
+
{ product: 'Blue Band', lastYearSale: 38, thisYearSale: 5, lastYearProfit: 12321, thisYearProfit: 8500 },
|
|
274
|
+
{
|
|
275
|
+
product: 'Blue T-Shirt',
|
|
276
|
+
lastYearSale: 49,
|
|
277
|
+
thisYearSale: 22,
|
|
278
|
+
lastYearProfit: 745232,
|
|
279
|
+
thisYearProfit: 65323
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
product: 'Brown Purse',
|
|
283
|
+
lastYearSale: 17,
|
|
284
|
+
thisYearSale: 79,
|
|
285
|
+
lastYearProfit: 643242,
|
|
286
|
+
thisYearProfit: 500332
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
product: 'Chakra Bracelet',
|
|
290
|
+
lastYearSale: 52,
|
|
291
|
+
thisYearSale: 65,
|
|
292
|
+
lastYearProfit: 421132,
|
|
293
|
+
thisYearProfit: 150005
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
product: 'Galaxy Earrings',
|
|
297
|
+
lastYearSale: 82,
|
|
298
|
+
thisYearSale: 12,
|
|
299
|
+
lastYearProfit: 131211,
|
|
300
|
+
thisYearProfit: 100214
|
|
301
|
+
},
|
|
302
|
+
{
|
|
303
|
+
product: 'Game Controller',
|
|
304
|
+
lastYearSale: 44,
|
|
305
|
+
thisYearSale: 45,
|
|
306
|
+
lastYearProfit: 66442,
|
|
307
|
+
thisYearProfit: 53322
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
product: 'Gaming Set',
|
|
311
|
+
lastYearSale: 90,
|
|
312
|
+
thisYearSale: 56,
|
|
313
|
+
lastYearProfit: 765442,
|
|
314
|
+
thisYearProfit: 296232
|
|
315
|
+
},
|
|
316
|
+
{
|
|
317
|
+
product: 'Gold Phone Case',
|
|
318
|
+
lastYearSale: 75,
|
|
319
|
+
thisYearSale: 54,
|
|
320
|
+
lastYearProfit: 21212,
|
|
321
|
+
thisYearProfit: 12533
|
|
322
|
+
}
|
|
323
|
+
];
|
|
324
|
+
this.calculateLastYearTotal();
|
|
325
|
+
this.calculateThisYearTotal();
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
calculateThisYearTotal() {
|
|
329
|
+
let total = 0;
|
|
330
|
+
for (let sale of this.sales) {
|
|
331
|
+
total += sale.thisYearProfit;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
this.thisYearTotal = total;
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
## columnresizeexpandmode-doc
|
|
340
|
+
|
|
341
|
+
Setting columnResizeMode as expand changes the table width as well.
|
|
342
|
+
|
|
343
|
+
```typescript
|
|
344
|
+
import { Component, OnInit, inject } from '@angular/core';
|
|
345
|
+
import { TableModule } from '@exhaustive-ui/core/table';
|
|
346
|
+
import { ProductService } from '@/service/productservice';
|
|
347
|
+
import { Product } from '@/domain/product';
|
|
348
|
+
|
|
349
|
+
@Component({
|
|
350
|
+
template: `
|
|
351
|
+
<div class="card">
|
|
352
|
+
<p-table [value]="products" showGridlines [resizableColumns]="true" columnResizeMode="expand" [tableStyle]="{ 'min-width': '50rem' }">
|
|
353
|
+
<ng-template #header>
|
|
354
|
+
<tr>
|
|
355
|
+
<th pResizableColumn>Code</th>
|
|
356
|
+
<th pResizableColumn>Name</th>
|
|
357
|
+
<th pResizableColumn>Category</th>
|
|
358
|
+
<th pResizableColumn>Quantity</th>
|
|
359
|
+
</tr>
|
|
360
|
+
</ng-template>
|
|
361
|
+
<ng-template #body let-product>
|
|
362
|
+
<tr>
|
|
363
|
+
<td>{{ product.code }}</td>
|
|
364
|
+
<td>{{ product.name }}</td>
|
|
365
|
+
<td>{{ product.category }}</td>
|
|
366
|
+
<td>{{ product.quantity }}</td>
|
|
367
|
+
</tr>
|
|
368
|
+
</ng-template>
|
|
369
|
+
</p-table>
|
|
370
|
+
</div>
|
|
371
|
+
`,
|
|
372
|
+
standalone: true,
|
|
373
|
+
imports: [TableModule],
|
|
374
|
+
providers: [ProductService]
|
|
375
|
+
})
|
|
376
|
+
export class TableColumnresizeexpandmodeDemo implements OnInit {
|
|
377
|
+
private productService = inject(ProductService);
|
|
378
|
+
products!: Product[];
|
|
379
|
+
|
|
380
|
+
ngOnInit() {
|
|
381
|
+
this.productService.getProductsMini().then((data) => {
|
|
382
|
+
this.products = data;
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
## columnresizefitmode-doc
|
|
389
|
+
|
|
390
|
+
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
|
+
|
|
392
|
+
```typescript
|
|
393
|
+
import { Component, OnInit, inject } from '@angular/core';
|
|
394
|
+
import { TableModule } from '@exhaustive-ui/core/table';
|
|
395
|
+
import { ProductService } from '@/service/productservice';
|
|
396
|
+
import { Product } from '@/domain/product';
|
|
397
|
+
|
|
398
|
+
@Component({
|
|
399
|
+
template: `
|
|
400
|
+
<div class="card">
|
|
401
|
+
<p-table [value]="products" showGridlines [resizableColumns]="true" [tableStyle]="{ 'min-width': '50rem' }">
|
|
402
|
+
<ng-template #header>
|
|
403
|
+
<tr>
|
|
404
|
+
<th pResizableColumn>Code</th>
|
|
405
|
+
<th pResizableColumn>Name</th>
|
|
406
|
+
<th pResizableColumn>Category</th>
|
|
407
|
+
<th pResizableColumn>Quantity</th>
|
|
408
|
+
</tr>
|
|
409
|
+
</ng-template>
|
|
410
|
+
<ng-template #body let-product>
|
|
411
|
+
<tr>
|
|
412
|
+
<td>{{ product.code }}</td>
|
|
413
|
+
<td>{{ product.name }}</td>
|
|
414
|
+
<td>{{ product.category }}</td>
|
|
415
|
+
<td>{{ product.quantity }}</td>
|
|
416
|
+
</tr>
|
|
417
|
+
</ng-template>
|
|
418
|
+
</p-table>
|
|
419
|
+
</div>
|
|
420
|
+
`,
|
|
421
|
+
standalone: true,
|
|
422
|
+
imports: [TableModule],
|
|
423
|
+
providers: [ProductService]
|
|
424
|
+
})
|
|
425
|
+
export class TableColumnresizefitmodeDemo implements OnInit {
|
|
426
|
+
private productService = inject(ProductService);
|
|
427
|
+
products!: Product[];
|
|
428
|
+
|
|
429
|
+
ngOnInit() {
|
|
430
|
+
this.productService.getProductsMini().then((data) => {
|
|
431
|
+
this.products = data;
|
|
432
|
+
});
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
```
|
|
436
|
+
|
|
437
|
+
## columnresizescrollablemode-doc
|
|
438
|
+
|
|
439
|
+
```typescript
|
|
440
|
+
import { Component, OnInit, inject } from '@angular/core';
|
|
441
|
+
import { TableModule } from '@exhaustive-ui/core/table';
|
|
442
|
+
import { CustomerService } from '@/service/customerservice';
|
|
443
|
+
import { Customer, Representative, Country } from '@/domain/customer';
|
|
444
|
+
|
|
445
|
+
@Component({
|
|
446
|
+
template: `
|
|
447
|
+
<div class="card">
|
|
448
|
+
<p-table [value]="customers" showGridlines [scrollable]="true" scrollHeight="400px" [resizableColumns]="true" [tableStyle]="{ 'min-width': '50rem' }">
|
|
449
|
+
<ng-template #header>
|
|
450
|
+
<tr>
|
|
451
|
+
<th pResizableColumn>Name</th>
|
|
452
|
+
<th pResizableColumn>Country</th>
|
|
453
|
+
<th pResizableColumn>Company</th>
|
|
454
|
+
<th pResizableColumn>Representative</th>
|
|
455
|
+
</tr>
|
|
456
|
+
</ng-template>
|
|
457
|
+
<ng-template #body let-customer>
|
|
458
|
+
<tr>
|
|
459
|
+
<td>{{ customer.name }}</td>
|
|
460
|
+
<td>{{ customer.country.name }}</td>
|
|
461
|
+
<td>{{ customer.company }}</td>
|
|
462
|
+
<td>{{ customer.representative.name }}</td>
|
|
463
|
+
</tr>
|
|
464
|
+
</ng-template>
|
|
465
|
+
</p-table>
|
|
466
|
+
</div>
|
|
467
|
+
`,
|
|
468
|
+
standalone: true,
|
|
469
|
+
imports: [TableModule],
|
|
470
|
+
providers: [CustomerService]
|
|
471
|
+
})
|
|
472
|
+
export class TableColumnresizescrollablemodeDemo implements OnInit {
|
|
473
|
+
private customerService = inject(CustomerService);
|
|
474
|
+
customers!: Customer[];
|
|
475
|
+
|
|
476
|
+
ngOnInit() {
|
|
477
|
+
this.customerService.getCustomersLarge().then((customers) => {
|
|
478
|
+
this.customers = customers;
|
|
479
|
+
});
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
```
|
|
483
|
+
|
|
484
|
+
## columnselection-doc
|
|
485
|
+
|
|
486
|
+
Row selection with an element inside a column is implemented with templating.
|
|
487
|
+
|
|
488
|
+
```typescript
|
|
489
|
+
import { Component, OnInit, inject } from '@angular/core';
|
|
490
|
+
import { ButtonModule } from '@exhaustive-ui/core/button';
|
|
491
|
+
import { TableModule } from '@exhaustive-ui/core/table';
|
|
492
|
+
import { ToastModule } from '@exhaustive-ui/core/toast';
|
|
493
|
+
import { ProductService } from '@/service/productservice';
|
|
494
|
+
import { MessageService } from '@exhaustive-ui/core/api';
|
|
495
|
+
import { Product } from '@/domain/product';
|
|
496
|
+
|
|
497
|
+
@Component({
|
|
498
|
+
template: `
|
|
499
|
+
<div class="card">
|
|
500
|
+
<p-toast />
|
|
501
|
+
<p-table [value]="products" [tableStyle]="{ 'min-width': '50rem' }">
|
|
502
|
+
<ng-template #header>
|
|
503
|
+
<tr>
|
|
504
|
+
<th>Code</th>
|
|
505
|
+
<th>Name</th>
|
|
506
|
+
<th>Category</th>
|
|
507
|
+
<th>Quantity</th>
|
|
508
|
+
<th style="width: 5rem"></th>
|
|
509
|
+
</tr>
|
|
510
|
+
</ng-template>
|
|
511
|
+
<ng-template #body let-product>
|
|
512
|
+
<tr>
|
|
513
|
+
<td>{{ product.code }}</td>
|
|
514
|
+
<td>{{ product.name }}</td>
|
|
515
|
+
<td>{{ product.category }}</td>
|
|
516
|
+
<td>{{ product.quantity }}</td>
|
|
517
|
+
<td>
|
|
518
|
+
<p-button icon="pi pi-search" (click)="selectProduct(product)" severity="secondary" rounded />
|
|
519
|
+
</td>
|
|
520
|
+
</tr>
|
|
521
|
+
</ng-template>
|
|
522
|
+
</p-table>
|
|
523
|
+
</div>
|
|
524
|
+
`,
|
|
525
|
+
standalone: true,
|
|
526
|
+
imports: [ButtonModule, TableModule, ToastModule],
|
|
527
|
+
providers: [ProductService, MessageService]
|
|
528
|
+
})
|
|
529
|
+
export class TableColumnselectionDemo implements OnInit {
|
|
530
|
+
private productService = inject(ProductService);
|
|
531
|
+
private messageService = inject(MessageService);
|
|
532
|
+
products!: Product[];
|
|
533
|
+
selectedProduct!: Product;
|
|
534
|
+
|
|
535
|
+
ngOnInit() {
|
|
536
|
+
this.productService.getProductsMini().then((data) => {
|
|
537
|
+
this.products = data;
|
|
538
|
+
});
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
selectProduct(product: Product) {
|
|
542
|
+
this.messageService.add({ severity: 'info', summary: 'Product Selected', detail: product.name });
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
```
|
|
546
|
+
|
|
547
|
+
## columntoggle-doc
|
|
548
|
+
|
|
549
|
+
This demo uses a multiselect component to implement toggleable columns.
|
|
550
|
+
|
|
551
|
+
```typescript
|
|
552
|
+
import { Component, OnInit, inject } from '@angular/core';
|
|
553
|
+
import { FormsModule } from '@angular/forms';
|
|
554
|
+
import { MultiSelectModule } from '@exhaustive-ui/core/multiselect';
|
|
555
|
+
import { TableModule } from '@exhaustive-ui/core/table';
|
|
556
|
+
import { ProductService } from '@/service/productservice';
|
|
557
|
+
import { Product } from '@/domain/product';
|
|
558
|
+
|
|
559
|
+
interface Column {
|
|
560
|
+
field: string;
|
|
561
|
+
header: string;
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
@Component({
|
|
565
|
+
template: `
|
|
566
|
+
<div class="card">
|
|
567
|
+
<p-table [columns]="selectedColumns" [value]="products" [tableStyle]="{ 'min-width': '50rem' }">
|
|
568
|
+
<ng-template #caption>
|
|
569
|
+
<p-multiselect display="chip" [options]="cols" [(ngModel)]="selectedColumns" optionLabel="header" selectedItemsLabel="{0} columns selected" [style]="{ 'min-width': '200px' }" placeholder="Choose Columns" />
|
|
570
|
+
</ng-template>
|
|
571
|
+
<ng-template #header let-columns>
|
|
572
|
+
<tr>
|
|
573
|
+
<th>Code</th>
|
|
574
|
+
<th *ngFor="let col of columns">
|
|
575
|
+
{{ col.header }}
|
|
576
|
+
</th>
|
|
577
|
+
</tr>
|
|
578
|
+
</ng-template>
|
|
579
|
+
<ng-template #body let-product let-columns="columns">
|
|
580
|
+
<tr>
|
|
581
|
+
<td>{{ product.code }}</td>
|
|
582
|
+
<td *ngFor="let col of columns">
|
|
583
|
+
{{ product[col.field] }}
|
|
584
|
+
</td>
|
|
585
|
+
</tr>
|
|
586
|
+
</ng-template>
|
|
587
|
+
</p-table>
|
|
588
|
+
</div>
|
|
589
|
+
`,
|
|
590
|
+
standalone: true,
|
|
591
|
+
imports: [MultiSelectModule, TableModule, FormsModule],
|
|
592
|
+
providers: [ProductService]
|
|
593
|
+
})
|
|
594
|
+
export class TableColumntoggleDemo implements OnInit {
|
|
595
|
+
private productService = inject(ProductService);
|
|
596
|
+
products!: Product[];
|
|
597
|
+
cols!: Column[];
|
|
598
|
+
selectedColumns!: Column[];
|
|
599
|
+
|
|
600
|
+
ngOnInit() {
|
|
601
|
+
this.productService.getProductsMini().then((data) => {
|
|
602
|
+
this.products = data;
|
|
603
|
+
});
|
|
604
|
+
this.cols = [
|
|
605
|
+
{ field: 'name', header: 'Name' },
|
|
606
|
+
{ field: 'category', header: 'Category' },
|
|
607
|
+
{ field: 'quantity', header: 'Quantity' }
|
|
608
|
+
];
|
|
609
|
+
this.selectedColumns = this.cols;
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
```
|
|
613
|
+
|
|
614
|
+
## contextmenu-doc
|
|
615
|
+
|
|
616
|
+
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
|
+
|
|
618
|
+
```typescript
|
|
619
|
+
import { Component, OnInit, inject } from '@angular/core';
|
|
620
|
+
import { ContextMenuModule } from '@exhaustive-ui/core/contextmenu';
|
|
621
|
+
import { Table, TableModule } from '@exhaustive-ui/core/table';
|
|
622
|
+
import { ToastModule } from '@exhaustive-ui/core/toast';
|
|
623
|
+
import { ProductService } from '@/service/productservice';
|
|
624
|
+
import { MenuItem, MessageService } from '@exhaustive-ui/core/api';
|
|
625
|
+
import { Product } from '@/domain/product';
|
|
626
|
+
|
|
627
|
+
@Component({
|
|
628
|
+
template: `
|
|
629
|
+
<div class="card">
|
|
630
|
+
<p-contextmenu #cm [model]="items" (onHide)="selectedProduct = null" />
|
|
631
|
+
<p-table [value]="products" [(contextMenuSelection)]="selectedProduct" [contextMenu]="cm" dataKey="code" [tableStyle]="{ 'min-width': '50rem' }">
|
|
632
|
+
<ng-template #header>
|
|
633
|
+
<tr>
|
|
634
|
+
<th>Code</th>
|
|
635
|
+
<th>Name</th>
|
|
636
|
+
<th>Category</th>
|
|
637
|
+
<th>Price</th>
|
|
638
|
+
</tr>
|
|
639
|
+
</ng-template>
|
|
640
|
+
<ng-template #body let-product>
|
|
641
|
+
<tr [pContextMenuRow]="product">
|
|
642
|
+
<td>{{ product.code }}</td>
|
|
643
|
+
<td>{{ product.name }}</td>
|
|
644
|
+
<td>{{ product.category }}</td>
|
|
645
|
+
<td>{{ product.price | currency: 'USD' }}</td>
|
|
646
|
+
</tr>
|
|
647
|
+
</ng-template>
|
|
648
|
+
</p-table>
|
|
649
|
+
<p-toast />
|
|
650
|
+
</div>
|
|
651
|
+
`,
|
|
652
|
+
standalone: true,
|
|
653
|
+
imports: [ContextMenuModule, TableModule, ToastModule],
|
|
654
|
+
providers: [ProductService, MessageService]
|
|
655
|
+
})
|
|
656
|
+
export class TableContextmenuDemo implements OnInit {
|
|
657
|
+
private productService = inject(ProductService);
|
|
658
|
+
private messageService = inject(MessageService);
|
|
659
|
+
products!: Product[];
|
|
660
|
+
selectedProduct!: Product;
|
|
661
|
+
items!: MenuItem[];
|
|
662
|
+
|
|
663
|
+
ngOnInit() {
|
|
664
|
+
this.productService.getProductsMini().then((data) => {
|
|
665
|
+
this.products = data;
|
|
666
|
+
});
|
|
667
|
+
this.items = [
|
|
668
|
+
{ label: 'View', icon: 'pi pi-fw pi-search', command: () => this.viewProduct(this.selectedProduct) },
|
|
669
|
+
{ label: 'Delete', icon: 'pi pi-fw pi-times', command: () => this.deleteProduct(this.selectedProduct) }
|
|
670
|
+
];
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
viewProduct(product: Product) {
|
|
674
|
+
this.messageService.add({ severity: 'info', summary: 'Product Selected', detail: product.name });
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
deleteProduct(product: Product) {
|
|
678
|
+
this.products = this.products.filter((p) => p.id !== product.id);
|
|
679
|
+
this.messageService.add({ severity: 'error', summary: 'Product Deleted', detail: product.name });
|
|
680
|
+
this.selectedProduct = null;
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
```
|
|
684
|
+
|
|
685
|
+
## Customers
|
|
686
|
+
|
|
687
|
+
DataTable with selection, pagination, filtering, sorting and templating.
|
|
688
|
+
|
|
689
|
+
```typescript
|
|
690
|
+
import { Component, OnInit, inject } from '@angular/core';
|
|
691
|
+
import { FormsModule } from '@angular/forms';
|
|
692
|
+
import { ButtonModule } from '@exhaustive-ui/core/button';
|
|
693
|
+
import { SelectModule } from '@exhaustive-ui/core/select';
|
|
694
|
+
import { IconFieldModule } from '@exhaustive-ui/core/iconfield';
|
|
695
|
+
import { InputIconModule } from '@exhaustive-ui/core/inputicon';
|
|
696
|
+
import { MultiSelectModule } from '@exhaustive-ui/core/multiselect';
|
|
697
|
+
import { ProgressBarModule } from '@exhaustive-ui/core/progressbar';
|
|
698
|
+
import { SliderModule } from '@exhaustive-ui/core/slider';
|
|
699
|
+
import { Table, TableModule } from '@exhaustive-ui/core/table';
|
|
700
|
+
import { TagModule } from '@exhaustive-ui/core/tag';
|
|
701
|
+
import { InputTextModule } from '@exhaustive-ui/core/inputtext';
|
|
702
|
+
import { CustomerService } from '@/service/customerservice';
|
|
703
|
+
import { Customer, Representative, Country } from '@/domain/customer';
|
|
704
|
+
|
|
705
|
+
@Component({
|
|
706
|
+
template: `
|
|
707
|
+
<div class="card">
|
|
708
|
+
<p-table
|
|
709
|
+
#dt
|
|
710
|
+
[value]="customers"
|
|
711
|
+
[(selection)]="selectedCustomers"
|
|
712
|
+
dataKey="id"
|
|
713
|
+
[rowHover]="true"
|
|
714
|
+
[rows]="10"
|
|
715
|
+
[showCurrentPageReport]="true"
|
|
716
|
+
[rowsPerPageOptions]="[10, 25, 50]"
|
|
717
|
+
[loading]="loading"
|
|
718
|
+
[paginator]="true"
|
|
719
|
+
currentPageReportTemplate="Showing {first} to {last} of {totalRecords} entries"
|
|
720
|
+
[filterDelay]="0"
|
|
721
|
+
[globalFilterFields]="['name', 'country.name', 'representative.name', 'status']"
|
|
722
|
+
>
|
|
723
|
+
<ng-template #caption>
|
|
724
|
+
<div class="flex justify-between">
|
|
725
|
+
<p-button [outlined]="true" icon="pi pi-filter-slash" label="Clear" (click)="clear(dt)" />
|
|
726
|
+
<p-iconField iconPosition="left">
|
|
727
|
+
<p-inputIcon>
|
|
728
|
+
<i class="pi pi-search"></i>
|
|
729
|
+
</p-inputIcon>
|
|
730
|
+
<input pInputText type="text" [(ngModel)]="searchValue" (input)="dt.filterGlobal($event.target.value, 'contains')" placeholder="Keyboard Search" />
|
|
731
|
+
</p-iconField>
|
|
732
|
+
</div>
|
|
733
|
+
</ng-template>
|
|
734
|
+
<ng-template #header>
|
|
735
|
+
<tr>
|
|
736
|
+
<th style="width: 4rem">
|
|
737
|
+
<p-tableHeaderCheckbox />
|
|
738
|
+
</th>
|
|
739
|
+
<th pSortableColumn="name" style="min-width: 14rem">
|
|
740
|
+
<div class="flex justify-between items-center gap-2">
|
|
741
|
+
Name
|
|
742
|
+
<p-sortIcon field="name" />
|
|
743
|
+
<p-columnFilter type="text" field="name" display="menu" class="ml-auto" />
|
|
744
|
+
</div>
|
|
745
|
+
</th>
|
|
746
|
+
<th pSortableColumn="country.name" style="min-width: 14rem">
|
|
747
|
+
<div class="flex justify-between items-center gap-2">
|
|
748
|
+
Country
|
|
749
|
+
<p-sortIcon field="country.name" />
|
|
750
|
+
<p-columnFilter type="text" field="country.name" display="menu" class="ml-auto" />
|
|
751
|
+
</div>
|
|
752
|
+
</th>
|
|
753
|
+
<th pSortableColumn="representative.name" style="min-width: 14rem">
|
|
754
|
+
<div class="flex justify-between items-center gap-2">
|
|
755
|
+
Agent
|
|
756
|
+
<p-sortIcon field="representative.name" />
|
|
757
|
+
<p-columnFilter field="representative" matchMode="in" display="menu" [showMatchModes]="false" [showOperator]="false" [showAddButton]="false" class="ml-auto">
|
|
758
|
+
<ng-template #filter let-value let-filter="filterCallback">
|
|
759
|
+
<p-multiselect [filter]="false" [(ngModel)]="value" [options]="representatives" placeholder="Any" (onChange)="filter($event.value)" optionLabel="name" class="w-full">
|
|
760
|
+
<ng-template let-option #item>
|
|
761
|
+
<div class="flex items-center gap-2">
|
|
762
|
+
<img [alt]="option.label" src="https://exhaustive-ui.e-xiste.com/demo/avatar/{{ option.image }}" style="width: 32px" />
|
|
763
|
+
<span>{{ option.name }}</span>
|
|
764
|
+
</div>
|
|
765
|
+
</ng-template>
|
|
766
|
+
</p-multiselect>
|
|
767
|
+
</ng-template>
|
|
768
|
+
</p-columnFilter>
|
|
769
|
+
</div>
|
|
770
|
+
</th>
|
|
771
|
+
<th pSortableColumn="date" style="min-width: 14rem">
|
|
772
|
+
<div class="flex justify-between items-center gap-2">
|
|
773
|
+
Date
|
|
774
|
+
<p-sortIcon field="date" />
|
|
775
|
+
<p-columnFilter type="date" field="date" display="menu" class="ml-auto" />
|
|
776
|
+
</div>
|
|
777
|
+
</th>
|
|
778
|
+
<th pSortableColumn="balance" style="min-width: 14rem">
|
|
779
|
+
<div class="flex justify-between items-center gap-2">
|
|
780
|
+
Balance
|
|
781
|
+
<p-sortIcon field="balance" />
|
|
782
|
+
<p-columnFilter type="numeric" field="balance" display="menu" currency="USD" class="ml-auto" />
|
|
783
|
+
</div>
|
|
784
|
+
</th>
|
|
785
|
+
<th pSortableColumn="status" style="min-width: 14rem">
|
|
786
|
+
<div class="flex justify-between items-center gap-2">
|
|
787
|
+
Status
|
|
788
|
+
<p-sortIcon field="status" />
|
|
789
|
+
<p-columnFilter field="status" matchMode="equals" display="menu" class="ml-auto">
|
|
790
|
+
<ng-template #filter let-value let-filter="filterCallback">
|
|
791
|
+
<p-select [(ngModel)]="value" [options]="statuses" (onChange)="filter($event.value)" placeholder="Any">
|
|
792
|
+
<ng-template let-option #item>
|
|
793
|
+
<p-tag [value]="option.label" [severity]="getSeverity(option.label)" />
|
|
794
|
+
</ng-template>
|
|
795
|
+
</p-select>
|
|
796
|
+
</ng-template>
|
|
797
|
+
</p-columnFilter>
|
|
798
|
+
</div>
|
|
799
|
+
</th>
|
|
800
|
+
<th pSortableColumn="activity" style="min-width: 14rem">
|
|
801
|
+
<div class="flex justify-between items-center gap-2">
|
|
802
|
+
Activity
|
|
803
|
+
<p-sortIcon field="activity" />
|
|
804
|
+
<p-columnFilter field="activity" matchMode="between" display="menu" [showMatchModes]="false" [showOperator]="false" [showAddButton]="false" class="ml-auto">
|
|
805
|
+
<ng-template #filter let-filter="filterCallback">
|
|
806
|
+
<p-slider [(ngModel)]="activityValues" [range]="true" (onSlideEnd)="filter($event.values)" class="m-4"></p-slider>
|
|
807
|
+
<div class="flex items-center justify-between px-2">
|
|
808
|
+
<span>{{ activityValues[0] }}</span>
|
|
809
|
+
<span>{{ activityValues[1] }}</span>
|
|
810
|
+
</div>
|
|
811
|
+
</ng-template>
|
|
812
|
+
</p-columnFilter>
|
|
813
|
+
</div>
|
|
814
|
+
</th>
|
|
815
|
+
<th style="width: 5rem"></th>
|
|
816
|
+
</tr>
|
|
817
|
+
</ng-template>
|
|
818
|
+
<ng-template #body let-customer>
|
|
819
|
+
<tr class="p-selectable-row">
|
|
820
|
+
<td>
|
|
821
|
+
<p-tableCheckbox [value]="customer" />
|
|
822
|
+
</td>
|
|
823
|
+
<td>
|
|
824
|
+
{{ customer.name }}
|
|
825
|
+
</td>
|
|
826
|
+
<td>
|
|
827
|
+
<div class="flex items-center gap-2">
|
|
828
|
+
<img src="https://exhaustive-ui.e-xiste.com/demo/flag/flag_placeholder.png" [class]="'flag flag-' + customer.country.code" style="width: 20px" />
|
|
829
|
+
<span class="ml-1 align-middle">{{ customer.country.name }}</span>
|
|
830
|
+
</div>
|
|
831
|
+
</td>
|
|
832
|
+
<td>
|
|
833
|
+
<div class="flex items-center gap-2">
|
|
834
|
+
<img [alt]="customer.representative.name" src="https://exhaustive-ui.e-xiste.com/demo/avatar/{{ customer.representative.image }}" width="32" style="vertical-align: middle" />
|
|
835
|
+
<span class="ml-1 align-middle">{{ customer.representative.name }}</span>
|
|
836
|
+
</div>
|
|
837
|
+
</td>
|
|
838
|
+
<td>
|
|
839
|
+
{{ customer.date | date: 'MM/dd/yyyy' }}
|
|
840
|
+
</td>
|
|
841
|
+
<td>
|
|
842
|
+
{{ customer.balance | currency: 'USD' : 'symbol' }}
|
|
843
|
+
</td>
|
|
844
|
+
<td>
|
|
845
|
+
<p-tag [value]="customer.status" [severity]="getSeverity(customer.status)" />
|
|
846
|
+
</td>
|
|
847
|
+
<td>
|
|
848
|
+
<p-progressBar [value]="customer.activity" [showValue]="false" />
|
|
849
|
+
</td>
|
|
850
|
+
<td style="text-align: center">
|
|
851
|
+
<p-button rounded icon="pi pi-cog" />
|
|
852
|
+
</td>
|
|
853
|
+
</tr>
|
|
854
|
+
</ng-template>
|
|
855
|
+
<ng-template #emptymessage>
|
|
856
|
+
<tr>
|
|
857
|
+
<td colspan="8">No customers found.</td>
|
|
858
|
+
</tr>
|
|
859
|
+
</ng-template>
|
|
860
|
+
</p-table>
|
|
861
|
+
</div>
|
|
862
|
+
`,
|
|
863
|
+
standalone: true,
|
|
864
|
+
imports: [ButtonModule, SelectModule, IconFieldModule, InputIconModule, MultiSelectModule, ProgressBarModule, SliderModule, TableModule, TagModule, InputTextModule, FormsModule],
|
|
865
|
+
providers: [CustomerService]
|
|
866
|
+
})
|
|
867
|
+
export class TableCustomersDemo implements OnInit {
|
|
868
|
+
private customerService = inject(CustomerService);
|
|
869
|
+
customers!: Customer[];
|
|
870
|
+
selectedCustomers!: Customer[];
|
|
871
|
+
representatives!: Representative[];
|
|
872
|
+
statuses!: any[];
|
|
873
|
+
loading: boolean = true;
|
|
874
|
+
activityValues: number[] = [0, 100];
|
|
875
|
+
searchValue: string | undefined;
|
|
876
|
+
|
|
877
|
+
ngOnInit() {
|
|
878
|
+
this.customerService.getCustomersLarge().then((customers) => {
|
|
879
|
+
this.customers = customers;
|
|
880
|
+
this.loading = false;
|
|
881
|
+
this.customers.forEach((customer) => (customer.date = new Date(<Date>customer.date)));
|
|
882
|
+
});
|
|
883
|
+
this.representatives = [
|
|
884
|
+
{ name: 'Amy Elsner', image: 'amyelsner.png' },
|
|
885
|
+
{ name: 'Anna Fali', image: 'annafali.png' },
|
|
886
|
+
{ name: 'Asiya Javayant', image: 'asiyajavayant.png' },
|
|
887
|
+
{ name: 'Bernardo Dominic', image: 'bernardodominic.png' },
|
|
888
|
+
{ name: 'Elwin Sharvill', image: 'elwinsharvill.png' },
|
|
889
|
+
{ name: 'Ioni Bowcher', image: 'ionibowcher.png' },
|
|
890
|
+
{ name: 'Ivan Magalhaes', image: 'ivanmagalhaes.png' },
|
|
891
|
+
{ name: 'Onyama Limba', image: 'onyamalimba.png' },
|
|
892
|
+
{ name: 'Stephen Shaw', image: 'stephenshaw.png' },
|
|
893
|
+
{ name: 'Xuxue Feng', image: 'xuxuefeng.png' }
|
|
894
|
+
];
|
|
895
|
+
this.statuses = [
|
|
896
|
+
{ label: 'Unqualified', value: 'unqualified' },
|
|
897
|
+
{ label: 'Qualified', value: 'qualified' },
|
|
898
|
+
{ label: 'New', value: 'new' },
|
|
899
|
+
{ label: 'Negotiation', value: 'negotiation' },
|
|
900
|
+
{ label: 'Renewal', value: 'renewal' },
|
|
901
|
+
{ label: 'Proposal', value: 'proposal' }
|
|
902
|
+
];
|
|
903
|
+
}
|
|
904
|
+
|
|
905
|
+
clear(dt: Table) {
|
|
906
|
+
this.searchValue = '';
|
|
907
|
+
dt.reset();
|
|
908
|
+
}
|
|
909
|
+
|
|
910
|
+
getSeverity(status: string) {
|
|
911
|
+
switch (status) {
|
|
912
|
+
case 'unqualified':
|
|
913
|
+
return 'danger';
|
|
914
|
+
|
|
915
|
+
case 'qualified':
|
|
916
|
+
return 'success';
|
|
917
|
+
|
|
918
|
+
case 'new':
|
|
919
|
+
return 'info';
|
|
920
|
+
|
|
921
|
+
case 'negotiation':
|
|
922
|
+
return 'warn';
|
|
923
|
+
|
|
924
|
+
case 'renewal':
|
|
925
|
+
return null;
|
|
926
|
+
}
|
|
927
|
+
}
|
|
928
|
+
}
|
|
929
|
+
```
|
|
930
|
+
|
|
931
|
+
## Dynamic Columns
|
|
932
|
+
|
|
933
|
+
Columns can be defined dynamically using the *ngFor directive.
|
|
934
|
+
|
|
935
|
+
```typescript
|
|
936
|
+
import { Component, OnInit, inject } from '@angular/core';
|
|
937
|
+
import { TableModule } from '@exhaustive-ui/core/table';
|
|
938
|
+
import { ProductService } from '@/service/productservice';
|
|
939
|
+
import { Product } from '@/domain/product';
|
|
940
|
+
|
|
941
|
+
interface Column {
|
|
942
|
+
field: string;
|
|
943
|
+
header: string;
|
|
944
|
+
}
|
|
945
|
+
|
|
946
|
+
@Component({
|
|
947
|
+
template: `
|
|
948
|
+
<div class="card">
|
|
949
|
+
<p-table [columns]="cols" [value]="products" [tableStyle]="{ 'min-width': '50rem' }">
|
|
950
|
+
<ng-template #header let-columns>
|
|
951
|
+
<tr>
|
|
952
|
+
@for (col of columns; track col) {
|
|
953
|
+
<th>
|
|
954
|
+
{{ col.header }}
|
|
955
|
+
</th>
|
|
956
|
+
}
|
|
957
|
+
</tr>
|
|
958
|
+
</ng-template>
|
|
959
|
+
<ng-template #body let-rowData let-columns="columns">
|
|
960
|
+
<tr>
|
|
961
|
+
@for (col of columns; track col) {
|
|
962
|
+
<td>
|
|
963
|
+
{{ rowData[col.field] }}
|
|
964
|
+
</td>
|
|
965
|
+
}
|
|
966
|
+
</tr>
|
|
967
|
+
</ng-template>
|
|
968
|
+
</p-table>
|
|
969
|
+
</div>
|
|
970
|
+
`,
|
|
971
|
+
standalone: true,
|
|
972
|
+
imports: [TableModule],
|
|
973
|
+
providers: [ProductService]
|
|
974
|
+
})
|
|
975
|
+
export class TableDynamicDemo implements OnInit {
|
|
976
|
+
private productService = inject(ProductService);
|
|
977
|
+
products!: Product[];
|
|
978
|
+
cols!: Column[];
|
|
979
|
+
|
|
980
|
+
ngOnInit() {
|
|
981
|
+
this.productService.getProductsMini().then((data) => {
|
|
982
|
+
this.products = data;
|
|
983
|
+
});
|
|
984
|
+
this.cols = [
|
|
985
|
+
{ field: 'code', header: 'Code' },
|
|
986
|
+
{ field: 'name', header: 'Name' },
|
|
987
|
+
{ field: 'category', header: 'Category' },
|
|
988
|
+
{ field: 'quantity', header: 'Quantity' }
|
|
989
|
+
];
|
|
990
|
+
}
|
|
991
|
+
}
|
|
992
|
+
```
|
|
993
|
+
|
|
994
|
+
## expandablerowgroup-doc
|
|
995
|
+
|
|
996
|
+
When expandableRowGroups is present in subheader based row grouping, groups can be expanded and collapsed. State of the expansions are controlled using the expandedRows and onRowToggle properties.
|
|
997
|
+
|
|
998
|
+
```typescript
|
|
999
|
+
import { Component, OnInit, inject } from '@angular/core';
|
|
1000
|
+
import { TableModule } from '@exhaustive-ui/core/table';
|
|
1001
|
+
import { TagModule } from '@exhaustive-ui/core/tag';
|
|
1002
|
+
import { ButtonModule } from '@exhaustive-ui/core/button';
|
|
1003
|
+
import { RippleModule } from '@exhaustive-ui/core/ripple';
|
|
1004
|
+
import { CustomerService } from '@/service/customerservice';
|
|
1005
|
+
import { Customer, Country } from '@/domain/customer';
|
|
1006
|
+
|
|
1007
|
+
@Component({
|
|
1008
|
+
template: `
|
|
1009
|
+
<div class="card">
|
|
1010
|
+
<p-table [value]="customers" sortField="representative.name" sortMode="single" dataKey="representative.name" rowGroupMode="subheader" groupRowsBy="representative.name" [tableStyle]="{ 'min-width': '70rem' }">
|
|
1011
|
+
<ng-template #header>
|
|
1012
|
+
<tr>
|
|
1013
|
+
<th style="width:20%">Name</th>
|
|
1014
|
+
<th style="width:20%">Country</th>
|
|
1015
|
+
<th style="width:20%">Company</th>
|
|
1016
|
+
<th style="width:20%">Status</th>
|
|
1017
|
+
<th style="width:20%">Date</th>
|
|
1018
|
+
</tr>
|
|
1019
|
+
</ng-template>
|
|
1020
|
+
<ng-template #groupheader let-customer let-rowIndex="rowIndex" let-expanded="expanded">
|
|
1021
|
+
<tr>
|
|
1022
|
+
<td colspan="5">
|
|
1023
|
+
<button type="button" pButton pRipple [pRowToggler]="customer" text rounded plain class="mr-2" [icon]="expanded ? 'pi pi-chevron-down' : 'pi pi-chevron-right'"></button>
|
|
1024
|
+
<img [alt]="customer.representative.name" src="https://exhaustive-ui.e-xiste.com/demo/avatar/{{ customer.representative.image }}" width="32" style="vertical-align: middle; display: inline-block" />
|
|
1025
|
+
<span class="font-bold ml-2">{{ customer.representative.name }}</span>
|
|
1026
|
+
</td>
|
|
1027
|
+
</tr>
|
|
1028
|
+
</ng-template>
|
|
1029
|
+
<ng-template #groupfooter let-customer>
|
|
1030
|
+
<tr class="p-rowgroup-footer">
|
|
1031
|
+
<td colspan="4" style="text-align: right">Total Customers</td>
|
|
1032
|
+
<td>{{ calculateCustomerTotal(customer.representative.name) }}</td>
|
|
1033
|
+
</tr>
|
|
1034
|
+
</ng-template>
|
|
1035
|
+
<ng-template #expandedrow let-customer>
|
|
1036
|
+
<tr>
|
|
1037
|
+
<td>
|
|
1038
|
+
{{ customer.name }}
|
|
1039
|
+
</td>
|
|
1040
|
+
<td>
|
|
1041
|
+
<div class="flex items-center gap-2">
|
|
1042
|
+
<img src="https://exhaustive-ui.e-xiste.com/demo/flag/flag_placeholder.png" [class]="'flag flag-' + customer.country.code" style="width: 20px" />
|
|
1043
|
+
<span>{{ customer.country.name }}</span>
|
|
1044
|
+
</div>
|
|
1045
|
+
</td>
|
|
1046
|
+
<td>
|
|
1047
|
+
{{ customer.company }}
|
|
1048
|
+
</td>
|
|
1049
|
+
<td>
|
|
1050
|
+
<p-tag [value]="customer.status" [severity]="getSeverity(customer.status)" />
|
|
1051
|
+
</td>
|
|
1052
|
+
<td>
|
|
1053
|
+
{{ customer.date }}
|
|
1054
|
+
</td>
|
|
1055
|
+
</tr>
|
|
1056
|
+
</ng-template>
|
|
1057
|
+
</p-table>
|
|
1058
|
+
</div>
|
|
1059
|
+
`,
|
|
1060
|
+
standalone: true,
|
|
1061
|
+
imports: [TableModule, TagModule, ButtonModule, RippleModule],
|
|
1062
|
+
providers: [CustomerService]
|
|
1063
|
+
})
|
|
1064
|
+
export class TableExpandablerowgroupDemo implements OnInit {
|
|
1065
|
+
private customerService = inject(CustomerService);
|
|
1066
|
+
customers!: Customer[];
|
|
1067
|
+
|
|
1068
|
+
ngOnInit() {
|
|
1069
|
+
this.customerService.getCustomersMedium().then((data) => {
|
|
1070
|
+
this.customers = data;
|
|
1071
|
+
});
|
|
1072
|
+
}
|
|
1073
|
+
|
|
1074
|
+
calculateCustomerTotal(name: string) {
|
|
1075
|
+
let total = 0;
|
|
1076
|
+
|
|
1077
|
+
if (this.customers) {
|
|
1078
|
+
for (let customer of this.customers) {
|
|
1079
|
+
if (customer.representative?.name === name) {
|
|
1080
|
+
total++;
|
|
1081
|
+
}
|
|
1082
|
+
}
|
|
1083
|
+
}
|
|
1084
|
+
|
|
1085
|
+
return total;
|
|
1086
|
+
}
|
|
1087
|
+
|
|
1088
|
+
getSeverity(status: string) {
|
|
1089
|
+
switch (status) {
|
|
1090
|
+
case 'unqualified':
|
|
1091
|
+
return 'danger';
|
|
1092
|
+
|
|
1093
|
+
case 'qualified':
|
|
1094
|
+
return 'success';
|
|
1095
|
+
|
|
1096
|
+
case 'new':
|
|
1097
|
+
return 'info';
|
|
1098
|
+
|
|
1099
|
+
case 'negotiation':
|
|
1100
|
+
return 'warn';
|
|
1101
|
+
|
|
1102
|
+
case 'renewal':
|
|
1103
|
+
return null;
|
|
1104
|
+
}
|
|
1105
|
+
}
|
|
1106
|
+
}
|
|
1107
|
+
```
|
|
1108
|
+
|
|
1109
|
+
## Export
|
|
1110
|
+
|
|
1111
|
+
Table can export its data to CSV format.
|
|
1112
|
+
|
|
1113
|
+
```typescript
|
|
1114
|
+
import { Component, OnInit, inject } from '@angular/core';
|
|
1115
|
+
import { ButtonModule } from '@exhaustive-ui/core/button';
|
|
1116
|
+
import { TableModule } from '@exhaustive-ui/core/table';
|
|
1117
|
+
import { ProductService } from '@/service/productservice';
|
|
1118
|
+
import { Product } from '@/domain/product';
|
|
1119
|
+
|
|
1120
|
+
interface Column {
|
|
1121
|
+
field: string;
|
|
1122
|
+
header: string;
|
|
1123
|
+
customExportHeader?: string;
|
|
1124
|
+
}
|
|
1125
|
+
|
|
1126
|
+
interface ExportColumn {
|
|
1127
|
+
title: string;
|
|
1128
|
+
dataKey: string;
|
|
1129
|
+
}
|
|
1130
|
+
|
|
1131
|
+
@Component({
|
|
1132
|
+
template: `
|
|
1133
|
+
<div class="card">
|
|
1134
|
+
<p-table #dt [columns]="cols" [value]="products" [exportHeader]="'customExportHeader'" [tableStyle]="{ 'min-width': '50rem' }">
|
|
1135
|
+
<ng-template #caption>
|
|
1136
|
+
<div class="text-end pb-4">
|
|
1137
|
+
<p-button icon="pi pi-external-link" label="Export" (click)="dt.exportCSV()" />
|
|
1138
|
+
</div>
|
|
1139
|
+
</ng-template>
|
|
1140
|
+
<ng-template #header let-columns>
|
|
1141
|
+
<tr>
|
|
1142
|
+
<th *ngFor="let col of columns">
|
|
1143
|
+
{{ col.header }}
|
|
1144
|
+
</th>
|
|
1145
|
+
</tr>
|
|
1146
|
+
</ng-template>
|
|
1147
|
+
<ng-template #body let-rowData let-columns="columns">
|
|
1148
|
+
<tr>
|
|
1149
|
+
<td *ngFor="let col of columns">
|
|
1150
|
+
{{ rowData[col.field] }}
|
|
1151
|
+
</td>
|
|
1152
|
+
</tr>
|
|
1153
|
+
</ng-template>
|
|
1154
|
+
</p-table>
|
|
1155
|
+
</div>
|
|
1156
|
+
`,
|
|
1157
|
+
standalone: true,
|
|
1158
|
+
imports: [ButtonModule, TableModule],
|
|
1159
|
+
providers: [ProductService]
|
|
1160
|
+
})
|
|
1161
|
+
export class TableExportDemo implements OnInit {
|
|
1162
|
+
private productService = inject(ProductService);
|
|
1163
|
+
products!: Product[];
|
|
1164
|
+
selectedProducts!: Product[];
|
|
1165
|
+
|
|
1166
|
+
ngOnInit() {
|
|
1167
|
+
this.productService.getProductsMini().then((data) => {
|
|
1168
|
+
this.products = data;
|
|
1169
|
+
});
|
|
1170
|
+
this.cols = [
|
|
1171
|
+
{ field: 'code', header: 'Code', customExportHeader: 'Product Code' },
|
|
1172
|
+
{ field: 'name', header: 'Name' },
|
|
1173
|
+
{ field: 'category', header: 'Category' },
|
|
1174
|
+
{ field: 'quantity', header: 'Quantity' }
|
|
1175
|
+
];
|
|
1176
|
+
this.exportColumns = this.cols.map((col) => ({ title: col.header, dataKey: col.field }));
|
|
1177
|
+
}
|
|
1178
|
+
}
|
|
1179
|
+
```
|
|
1180
|
+
|
|
1181
|
+
## Advanced
|
|
1182
|
+
|
|
1183
|
+
Filters are displayed in an overlay.
|
|
1184
|
+
|
|
1185
|
+
```typescript
|
|
1186
|
+
import { Component, OnInit, inject, signal } from '@angular/core';
|
|
1187
|
+
import { FormsModule } from '@angular/forms';
|
|
1188
|
+
import { ButtonModule } from '@exhaustive-ui/core/button';
|
|
1189
|
+
import { SelectModule } from '@exhaustive-ui/core/select';
|
|
1190
|
+
import { IconFieldModule } from '@exhaustive-ui/core/iconfield';
|
|
1191
|
+
import { InputIconModule } from '@exhaustive-ui/core/inputicon';
|
|
1192
|
+
import { MultiSelectModule } from '@exhaustive-ui/core/multiselect';
|
|
1193
|
+
import { ProgressBarModule } from '@exhaustive-ui/core/progressbar';
|
|
1194
|
+
import { SliderModule } from '@exhaustive-ui/core/slider';
|
|
1195
|
+
import { Table, TableModule } from '@exhaustive-ui/core/table';
|
|
1196
|
+
import { TagModule } from '@exhaustive-ui/core/tag';
|
|
1197
|
+
import { InputTextModule } from '@exhaustive-ui/core/inputtext';
|
|
1198
|
+
import { CustomerService } from '@/service/customerservice';
|
|
1199
|
+
import { Customer, Representative, Country } from '@/domain/customer';
|
|
1200
|
+
|
|
1201
|
+
@Component({
|
|
1202
|
+
template: `
|
|
1203
|
+
<div class="card">
|
|
1204
|
+
<p-table #dt1 [value]="customers()" dataKey="id" [rows]="10" [rowsPerPageOptions]="[10, 25, 50]" [loading]="loading()" [paginator]="true" [globalFilterFields]="['name', 'country.name', 'representative.name', 'status']" showGridlines>
|
|
1205
|
+
<ng-template #caption>
|
|
1206
|
+
<div class="flex">
|
|
1207
|
+
<p-button label="Clear" [outlined]="true" icon="pi pi-filter-slash" (click)="clear(dt1)" />
|
|
1208
|
+
<p-iconfield iconPosition="left" class="ml-auto">
|
|
1209
|
+
<p-inputicon>
|
|
1210
|
+
<i class="pi pi-search"></i>
|
|
1211
|
+
</p-inputicon>
|
|
1212
|
+
<input pInputText type="text" (input)="dt1.filterGlobal($event.target.value, 'contains')" placeholder="Search keyword" />
|
|
1213
|
+
</p-iconfield>
|
|
1214
|
+
</div>
|
|
1215
|
+
</ng-template>
|
|
1216
|
+
<ng-template #header>
|
|
1217
|
+
<tr>
|
|
1218
|
+
<th style="min-width:15rem">
|
|
1219
|
+
<div class="flex items-center justify-between">
|
|
1220
|
+
Name
|
|
1221
|
+
<p-columnFilter type="text" field="name" display="menu" />
|
|
1222
|
+
</div>
|
|
1223
|
+
</th>
|
|
1224
|
+
<th style="min-width:15rem">
|
|
1225
|
+
<div class="flex items-center justify-between">
|
|
1226
|
+
Country
|
|
1227
|
+
<p-columnFilter type="text" field="country.name" display="menu" />
|
|
1228
|
+
</div>
|
|
1229
|
+
</th>
|
|
1230
|
+
<th style="min-width:15rem">
|
|
1231
|
+
<div class="flex items-center justify-between">
|
|
1232
|
+
Agent
|
|
1233
|
+
<p-columnFilter field="representative" matchMode="in" display="menu" [showMatchModes]="false" [showOperator]="false" [showAddButton]="false">
|
|
1234
|
+
<ng-template #filter let-value let-filter="filterCallback">
|
|
1235
|
+
<p-multiselect [(ngModel)]="value" [options]="representatives()" placeholder="Any" (onChange)="filter($event.value)" optionLabel="name" style="min-width: 14rem" [panelStyle]="{ minWidth: '16rem' }">
|
|
1236
|
+
<ng-template let-option #item>
|
|
1237
|
+
<div class="flex items-center gap-2">
|
|
1238
|
+
<img [alt]="option.label" src="https://exhaustive-ui.e-xiste.com/demo/avatar/{{ option.image }}" style="width: 32px" />
|
|
1239
|
+
<span>{{ option.name }}</span>
|
|
1240
|
+
</div>
|
|
1241
|
+
</ng-template>
|
|
1242
|
+
</p-multiselect>
|
|
1243
|
+
</ng-template>
|
|
1244
|
+
</p-columnFilter>
|
|
1245
|
+
</div>
|
|
1246
|
+
</th>
|
|
1247
|
+
<th style="min-width:10rem">
|
|
1248
|
+
<div class="flex items-center justify-between">
|
|
1249
|
+
Date
|
|
1250
|
+
<p-columnFilter type="date" field="date" display="menu"></p-columnFilter>
|
|
1251
|
+
</div>
|
|
1252
|
+
</th>
|
|
1253
|
+
<th style="min-width:10rem">
|
|
1254
|
+
<div class="flex items-center justify-between">
|
|
1255
|
+
Balance
|
|
1256
|
+
<p-columnFilter type="numeric" field="balance" display="menu" currency="USD" />
|
|
1257
|
+
</div>
|
|
1258
|
+
</th>
|
|
1259
|
+
<th style="min-width:10rem">
|
|
1260
|
+
<div class="flex items-center justify-between">
|
|
1261
|
+
Status
|
|
1262
|
+
<p-columnFilter field="status" matchMode="equals" display="menu">
|
|
1263
|
+
<ng-template #filter let-value let-filter="filterCallback">
|
|
1264
|
+
<p-select [(ngModel)]="value" [options]="statuses()" (onChange)="filter($event.value)" placeholder="Select One" class="w-full">
|
|
1265
|
+
<ng-template let-option #item>
|
|
1266
|
+
<p-tag [value]="option.value" [severity]="getSeverity(option.value)"></p-tag>
|
|
1267
|
+
</ng-template>
|
|
1268
|
+
</p-select>
|
|
1269
|
+
</ng-template>
|
|
1270
|
+
</p-columnFilter>
|
|
1271
|
+
</div>
|
|
1272
|
+
</th>
|
|
1273
|
+
<th style="min-width:10rem">
|
|
1274
|
+
<div class="flex items-center justify-between">
|
|
1275
|
+
Activity
|
|
1276
|
+
<p-columnFilter field="activity" matchMode="between" display="menu" [showMatchModes]="false" [showOperator]="false" [showAddButton]="false">
|
|
1277
|
+
<ng-template #filter let-value let-filter="filterCallback">
|
|
1278
|
+
<p-slider [(ngModel)]="value" [range]="true" class="m-4" (onSlideEnd)="filter($event.values)" />
|
|
1279
|
+
<div class="flex items-center px-2">
|
|
1280
|
+
<span *ngIf="!value">0</span>
|
|
1281
|
+
<span *ngIf="value">{{ value[0] }} - {{ value[1] }}</span>
|
|
1282
|
+
</div>
|
|
1283
|
+
</ng-template>
|
|
1284
|
+
</p-columnFilter>
|
|
1285
|
+
</div>
|
|
1286
|
+
</th>
|
|
1287
|
+
<th style="width: 3rem">
|
|
1288
|
+
<div class="flex items-center justify-between">
|
|
1289
|
+
Verified
|
|
1290
|
+
<p-columnFilter type="boolean" field="verified" display="menu" />
|
|
1291
|
+
</div>
|
|
1292
|
+
</th>
|
|
1293
|
+
</tr>
|
|
1294
|
+
</ng-template>
|
|
1295
|
+
<ng-template #body let-customer>
|
|
1296
|
+
<tr>
|
|
1297
|
+
<td>
|
|
1298
|
+
{{ customer.name }}
|
|
1299
|
+
</td>
|
|
1300
|
+
<td>
|
|
1301
|
+
<div class="flex items-center gap-2">
|
|
1302
|
+
<img src="https://exhaustive-ui.e-xiste.com/demo/flag/flag_placeholder.png" [class]="'flag flag-' + customer.country.code" style="width: 20px" />
|
|
1303
|
+
<span>{{ customer.country.name }}</span>
|
|
1304
|
+
</div>
|
|
1305
|
+
</td>
|
|
1306
|
+
<td>
|
|
1307
|
+
<div class="flex items-center gap-2">
|
|
1308
|
+
<img [alt]="customer.representative.name" src="https://exhaustive-ui.e-xiste.com/demo/avatar/{{ customer.representative.image }}" width="32" />
|
|
1309
|
+
<span>{{ customer.representative.name }}</span>
|
|
1310
|
+
</div>
|
|
1311
|
+
</td>
|
|
1312
|
+
<td>
|
|
1313
|
+
{{ customer.date | date: 'MM/dd/yyyy' }}
|
|
1314
|
+
</td>
|
|
1315
|
+
<td>
|
|
1316
|
+
{{ customer.balance | currency: 'USD' : 'symbol' }}
|
|
1317
|
+
</td>
|
|
1318
|
+
<td>
|
|
1319
|
+
<p-tag [value]="customer.status" [severity]="getSeverity(customer.status)" />
|
|
1320
|
+
</td>
|
|
1321
|
+
<td>
|
|
1322
|
+
<p-progressbar [value]="customer.activity" [showValue]="false" />
|
|
1323
|
+
</td>
|
|
1324
|
+
<td class="text-center">
|
|
1325
|
+
<i
|
|
1326
|
+
class="pi"
|
|
1327
|
+
[ngClass]="{
|
|
1328
|
+
'text-green-500 pi-check-circle': customer.verified,
|
|
1329
|
+
'text-red-500 pi-times-circle': !customer.verified
|
|
1330
|
+
}"
|
|
1331
|
+
></i>
|
|
1332
|
+
</td>
|
|
1333
|
+
</tr>
|
|
1334
|
+
</ng-template>
|
|
1335
|
+
<ng-template #emptymessage>
|
|
1336
|
+
<tr>
|
|
1337
|
+
<td colspan="7">No customers found.</td>
|
|
1338
|
+
</tr>
|
|
1339
|
+
</ng-template>
|
|
1340
|
+
</p-table>
|
|
1341
|
+
</div>
|
|
1342
|
+
`,
|
|
1343
|
+
standalone: true,
|
|
1344
|
+
imports: [ButtonModule, SelectModule, IconFieldModule, InputIconModule, MultiSelectModule, ProgressBarModule, SliderModule, TableModule, TagModule, InputTextModule, FormsModule],
|
|
1345
|
+
providers: [CustomerService]
|
|
1346
|
+
})
|
|
1347
|
+
export class TableFilterAdvancedDemo implements OnInit {
|
|
1348
|
+
private customerService = inject(CustomerService);
|
|
1349
|
+
customerService = inject(CustomerService);
|
|
1350
|
+
customers = signal<Customer[]>([]);
|
|
1351
|
+
representatives = signal<Representative[]>([]);
|
|
1352
|
+
statuses = signal<any[]>([]);
|
|
1353
|
+
loading = signal(true);
|
|
1354
|
+
searchValue = signal('');
|
|
1355
|
+
activityValues = signal<number[]>([0, 100]);
|
|
1356
|
+
|
|
1357
|
+
ngOnInit() {
|
|
1358
|
+
this.customerService.getCustomersLarge().then((customers) => {
|
|
1359
|
+
customers.forEach((customer: Customer) => (customer.date = new Date(customer.date as string)));
|
|
1360
|
+
this.customers.set(customers);
|
|
1361
|
+
this.loading.set(false);
|
|
1362
|
+
});
|
|
1363
|
+
this.representatives.set([
|
|
1364
|
+
{ name: 'Amy Elsner', image: 'amyelsner.png' },
|
|
1365
|
+
{ name: 'Anna Fali', image: 'annafali.png' },
|
|
1366
|
+
{ name: 'Asiya Javayant', image: 'asiyajavayant.png' },
|
|
1367
|
+
{ name: 'Bernardo Dominic', image: 'bernardodominic.png' },
|
|
1368
|
+
{ name: 'Elwin Sharvill', image: 'elwinsharvill.png' },
|
|
1369
|
+
{ name: 'Ioni Bowcher', image: 'ionibowcher.png' },
|
|
1370
|
+
{ name: 'Ivan Magalhaes', image: 'ivanmagalhaes.png' },
|
|
1371
|
+
{ name: 'Onyama Limba', image: 'onyamalimba.png' },
|
|
1372
|
+
{ name: 'Stephen Shaw', image: 'stephenshaw.png' },
|
|
1373
|
+
{ name: 'Xuxue Feng', image: 'xuxuefeng.png' }
|
|
1374
|
+
]);
|
|
1375
|
+
this.statuses.set([
|
|
1376
|
+
{ label: 'Unqualified', value: 'unqualified' },
|
|
1377
|
+
{ label: 'Qualified', value: 'qualified' },
|
|
1378
|
+
{ label: 'New', value: 'new' },
|
|
1379
|
+
{ label: 'Negotiation', value: 'negotiation' },
|
|
1380
|
+
{ label: 'Renewal', value: 'renewal' },
|
|
1381
|
+
{ label: 'Proposal', value: 'proposal' }
|
|
1382
|
+
]);
|
|
1383
|
+
}
|
|
1384
|
+
|
|
1385
|
+
clear(table: Table) {
|
|
1386
|
+
table.clear();
|
|
1387
|
+
this.searchValue.set('');
|
|
1388
|
+
}
|
|
1389
|
+
|
|
1390
|
+
getSeverity(status: string) {
|
|
1391
|
+
switch (status) {
|
|
1392
|
+
case 'unqualified':
|
|
1393
|
+
return 'danger';
|
|
1394
|
+
|
|
1395
|
+
case 'qualified':
|
|
1396
|
+
return 'success';
|
|
1397
|
+
|
|
1398
|
+
case 'new':
|
|
1399
|
+
return 'info';
|
|
1400
|
+
|
|
1401
|
+
case 'negotiation':
|
|
1402
|
+
return 'warn';
|
|
1403
|
+
|
|
1404
|
+
case 'renewal':
|
|
1405
|
+
return null;
|
|
1406
|
+
}
|
|
1407
|
+
}
|
|
1408
|
+
}
|
|
1409
|
+
```
|
|
1410
|
+
|
|
1411
|
+
## filterbasic-doc
|
|
1412
|
+
|
|
1413
|
+
Data filtering is enabled by defining the filters property referring to a DataTableFilterMeta instance. Each column to filter also requires filter to be enabled. Built-in filter element is a input field and using filterElement , 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
|
+
|
|
1415
|
+
```typescript
|
|
1416
|
+
import { Component, OnInit, inject } from '@angular/core';
|
|
1417
|
+
import { FormsModule } from '@angular/forms';
|
|
1418
|
+
import { SelectModule } from '@exhaustive-ui/core/select';
|
|
1419
|
+
import { IconFieldModule } from '@exhaustive-ui/core/iconfield';
|
|
1420
|
+
import { InputIconModule } from '@exhaustive-ui/core/inputicon';
|
|
1421
|
+
import { MultiSelectModule } from '@exhaustive-ui/core/multiselect';
|
|
1422
|
+
import { Table, TableModule } from '@exhaustive-ui/core/table';
|
|
1423
|
+
import { TagModule } from '@exhaustive-ui/core/tag';
|
|
1424
|
+
import { InputTextModule } from '@exhaustive-ui/core/inputtext';
|
|
1425
|
+
import { CustomerService } from '@/service/customerservice';
|
|
1426
|
+
import { Customer, Representative, Country } from '@/domain/customer';
|
|
1427
|
+
|
|
1428
|
+
@Component({
|
|
1429
|
+
template: `
|
|
1430
|
+
<div class="card">
|
|
1431
|
+
<p-table
|
|
1432
|
+
#dt2
|
|
1433
|
+
[value]="customers"
|
|
1434
|
+
dataKey="id"
|
|
1435
|
+
[rows]="10"
|
|
1436
|
+
[rowsPerPageOptions]="[10, 25, 50]"
|
|
1437
|
+
[loading]="loading"
|
|
1438
|
+
[paginator]="true"
|
|
1439
|
+
[globalFilterFields]="['name', 'country.name', 'representative.name', 'status']"
|
|
1440
|
+
[tableStyle]="{ 'min-width': '75rem' }"
|
|
1441
|
+
>
|
|
1442
|
+
<ng-template #caption>
|
|
1443
|
+
<div class="flex">
|
|
1444
|
+
<p-iconfield iconPosition="left" class="ml-auto">
|
|
1445
|
+
<p-inputicon>
|
|
1446
|
+
<i class="pi pi-search"></i>
|
|
1447
|
+
</p-inputicon>
|
|
1448
|
+
<input pInputText type="text" (input)="dt2.filterGlobal($event.target.value, 'contains')" placeholder="Search keyword" />
|
|
1449
|
+
</p-iconfield>
|
|
1450
|
+
</div>
|
|
1451
|
+
</ng-template>
|
|
1452
|
+
<ng-template #header>
|
|
1453
|
+
<tr>
|
|
1454
|
+
<th style="width:22%">Name</th>
|
|
1455
|
+
<th style="width:22%">Country</th>
|
|
1456
|
+
<th style="width:22%">Agent</th>
|
|
1457
|
+
<th style="width:22%">Status</th>
|
|
1458
|
+
<th style="width:12%">Verified</th>
|
|
1459
|
+
</tr>
|
|
1460
|
+
<tr>
|
|
1461
|
+
<th>
|
|
1462
|
+
<p-columnFilter type="text" field="name" placeholder="Type to search" ariaLabel="Filter Name" filterOn="input"></p-columnFilter>
|
|
1463
|
+
</th>
|
|
1464
|
+
<th>
|
|
1465
|
+
<p-columnFilter type="text" field="country.name" placeholder="Enter key to search" ariaLabel="Filter Country"></p-columnFilter>
|
|
1466
|
+
</th>
|
|
1467
|
+
<th>
|
|
1468
|
+
<p-columnFilter field="representative" matchMode="in" [showMenu]="false">
|
|
1469
|
+
<ng-template #filter let-value let-filter="filterCallback">
|
|
1470
|
+
<p-multiselect [(ngModel)]="value" [options]="representatives" placeholder="Any" (onChange)="filter($event.value)" optionLabel="name" style="min-width: 14rem" [panelStyle]="{ minWidth: '16rem' }">
|
|
1471
|
+
<ng-template let-option #item>
|
|
1472
|
+
<div class="flex items-center gap-2">
|
|
1473
|
+
<img [alt]="option.label" src="https://exhaustive-ui.e-xiste.com/demo/avatar/{{ option.image }}" style="width: 32px" />
|
|
1474
|
+
<span>{{ option.name }}</span>
|
|
1475
|
+
</div>
|
|
1476
|
+
</ng-template>
|
|
1477
|
+
</p-multiselect>
|
|
1478
|
+
</ng-template>
|
|
1479
|
+
</p-columnFilter>
|
|
1480
|
+
</th>
|
|
1481
|
+
<th>
|
|
1482
|
+
<p-columnFilter field="status" matchMode="equals" [showMenu]="false">
|
|
1483
|
+
<ng-template #filter let-value let-filter="filterCallback">
|
|
1484
|
+
<p-select [(ngModel)]="value" [options]="statuses" (onChange)="filter($event.value)" placeholder="Select One" [showClear]="true" style="min-width: 12rem">
|
|
1485
|
+
<ng-template let-option #item>
|
|
1486
|
+
<p-tag [value]="option.value" [severity]="getSeverity(option.value)" />
|
|
1487
|
+
</ng-template>
|
|
1488
|
+
</p-select>
|
|
1489
|
+
</ng-template>
|
|
1490
|
+
</p-columnFilter>
|
|
1491
|
+
</th>
|
|
1492
|
+
<th>
|
|
1493
|
+
<p-columnFilter type="boolean" field="verified"></p-columnFilter>
|
|
1494
|
+
</th>
|
|
1495
|
+
</tr>
|
|
1496
|
+
</ng-template>
|
|
1497
|
+
<ng-template #body let-customer>
|
|
1498
|
+
<tr>
|
|
1499
|
+
<td>
|
|
1500
|
+
{{ customer.name }}
|
|
1501
|
+
</td>
|
|
1502
|
+
<td>
|
|
1503
|
+
<div class="flex items-center gap-2">
|
|
1504
|
+
<img src="https://exhaustive-ui.e-xiste.com/demo/flag/flag_placeholder.png" [class]="'flag flag-' + customer.country.code" style="width: 20px" />
|
|
1505
|
+
<span>{{ customer.country.name }}</span>
|
|
1506
|
+
</div>
|
|
1507
|
+
</td>
|
|
1508
|
+
<td>
|
|
1509
|
+
<div class="flex items-center gap-2">
|
|
1510
|
+
<img [alt]="customer.representative.name" src="https://exhaustive-ui.e-xiste.com/demo/avatar/{{ customer.representative.image }}" width="32" style="vertical-align: middle" />
|
|
1511
|
+
<span>{{ customer.representative.name }}</span>
|
|
1512
|
+
</div>
|
|
1513
|
+
</td>
|
|
1514
|
+
<td>
|
|
1515
|
+
<p-tag [value]="customer.status" [severity]="getSeverity(customer.status)" />
|
|
1516
|
+
</td>
|
|
1517
|
+
<td>
|
|
1518
|
+
<i
|
|
1519
|
+
class="pi"
|
|
1520
|
+
[ngClass]="{
|
|
1521
|
+
'text-green-500 pi-check-circle': customer.verified,
|
|
1522
|
+
'text-red-500 pi-times-circle': !customer.verified
|
|
1523
|
+
}"
|
|
1524
|
+
></i>
|
|
1525
|
+
</td>
|
|
1526
|
+
</tr>
|
|
1527
|
+
</ng-template>
|
|
1528
|
+
<ng-template #emptymessage>
|
|
1529
|
+
<tr>
|
|
1530
|
+
<td colspan="5">No customers found.</td>
|
|
1531
|
+
</tr>
|
|
1532
|
+
</ng-template>
|
|
1533
|
+
</p-table>
|
|
1534
|
+
</div>
|
|
1535
|
+
`,
|
|
1536
|
+
standalone: true,
|
|
1537
|
+
imports: [SelectModule, IconFieldModule, InputIconModule, MultiSelectModule, TableModule, TagModule, InputTextModule, FormsModule],
|
|
1538
|
+
providers: [CustomerService]
|
|
1539
|
+
})
|
|
1540
|
+
export class TableFilterbasicDemo implements OnInit {
|
|
1541
|
+
private customerService = inject(CustomerService);
|
|
1542
|
+
customers!: Customer[];
|
|
1543
|
+
representatives!: Representative[];
|
|
1544
|
+
statuses!: any[];
|
|
1545
|
+
loading: boolean = true;
|
|
1546
|
+
activityValues: number[] = [0, 100];
|
|
1547
|
+
|
|
1548
|
+
ngOnInit() {
|
|
1549
|
+
this.customerService.getCustomersLarge().then((customers) => {
|
|
1550
|
+
this.customers = customers;
|
|
1551
|
+
this.loading = false;
|
|
1552
|
+
this.customers.forEach((customer) => (customer.date = new Date(<Date>customer.date)));
|
|
1553
|
+
});
|
|
1554
|
+
this.representatives = [
|
|
1555
|
+
{ name: 'Amy Elsner', image: 'amyelsner.png' },
|
|
1556
|
+
{ name: 'Anna Fali', image: 'annafali.png' },
|
|
1557
|
+
{ name: 'Asiya Javayant', image: 'asiyajavayant.png' },
|
|
1558
|
+
{ name: 'Bernardo Dominic', image: 'bernardodominic.png' },
|
|
1559
|
+
{ name: 'Elwin Sharvill', image: 'elwinsharvill.png' },
|
|
1560
|
+
{ name: 'Ioni Bowcher', image: 'ionibowcher.png' },
|
|
1561
|
+
{ name: 'Ivan Magalhaes', image: 'ivanmagalhaes.png' },
|
|
1562
|
+
{ name: 'Onyama Limba', image: 'onyamalimba.png' },
|
|
1563
|
+
{ name: 'Stephen Shaw', image: 'stephenshaw.png' },
|
|
1564
|
+
{ name: 'Xuxue Feng', image: 'xuxuefeng.png' }
|
|
1565
|
+
];
|
|
1566
|
+
this.statuses = [
|
|
1567
|
+
{ label: 'Unqualified', value: 'unqualified' },
|
|
1568
|
+
{ label: 'Qualified', value: 'qualified' },
|
|
1569
|
+
{ label: 'New', value: 'new' },
|
|
1570
|
+
{ label: 'Negotiation', value: 'negotiation' },
|
|
1571
|
+
{ label: 'Renewal', value: 'renewal' },
|
|
1572
|
+
{ label: 'Proposal', value: 'proposal' }
|
|
1573
|
+
];
|
|
1574
|
+
}
|
|
1575
|
+
|
|
1576
|
+
clear(table: Table) {
|
|
1577
|
+
table.clear();
|
|
1578
|
+
}
|
|
1579
|
+
|
|
1580
|
+
getSeverity(status: string) {
|
|
1581
|
+
switch (status) {
|
|
1582
|
+
case 'unqualified':
|
|
1583
|
+
return 'danger';
|
|
1584
|
+
|
|
1585
|
+
case 'qualified':
|
|
1586
|
+
return 'success';
|
|
1587
|
+
|
|
1588
|
+
case 'new':
|
|
1589
|
+
return 'info';
|
|
1590
|
+
|
|
1591
|
+
case 'negotiation':
|
|
1592
|
+
return 'warn';
|
|
1593
|
+
|
|
1594
|
+
case 'renewal':
|
|
1595
|
+
return null;
|
|
1596
|
+
}
|
|
1597
|
+
}
|
|
1598
|
+
}
|
|
1599
|
+
```
|
|
1600
|
+
|
|
1601
|
+
## flexiblescroll-doc
|
|
1602
|
+
|
|
1603
|
+
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
|
+
|
|
1605
|
+
```typescript
|
|
1606
|
+
import { Component, OnInit, inject } from '@angular/core';
|
|
1607
|
+
import { ButtonModule } from '@exhaustive-ui/core/button';
|
|
1608
|
+
import { Dialog, DialogModule } from '@exhaustive-ui/core/dialog';
|
|
1609
|
+
import { TableModule } from '@exhaustive-ui/core/table';
|
|
1610
|
+
import { CustomerService } from '@/service/customerservice';
|
|
1611
|
+
import { Customer, Representative, Country } from '@/domain/customer';
|
|
1612
|
+
|
|
1613
|
+
@Component({
|
|
1614
|
+
template: `
|
|
1615
|
+
<div class="card">
|
|
1616
|
+
<div class="flex justify-center">
|
|
1617
|
+
<button type="button" (click)="showDialog()" pButton icon="pi pi-external-link" label="Show"></button>
|
|
1618
|
+
</div>
|
|
1619
|
+
<p-dialog header="Header" [resizable]="false" [modal]="true" [maximizable]="true" appendTo="body" [(visible)]="dialogVisible" [style]="{ width: '75vw' }" [contentStyle]="{ height: '300px' }">
|
|
1620
|
+
<p-table [value]="customers" [scrollable]="true" scrollHeight="flex" [tableStyle]="{ 'min-width': '50rem' }">
|
|
1621
|
+
<ng-template #header>
|
|
1622
|
+
<tr>
|
|
1623
|
+
<th>Name</th>
|
|
1624
|
+
<th>Country</th>
|
|
1625
|
+
<th>Company</th>
|
|
1626
|
+
<th>Representative</th>
|
|
1627
|
+
</tr>
|
|
1628
|
+
</ng-template>
|
|
1629
|
+
<ng-template #body let-customer>
|
|
1630
|
+
<tr>
|
|
1631
|
+
<td>{{ customer.name }}</td>
|
|
1632
|
+
<td>{{ customer.country.name }}</td>
|
|
1633
|
+
<td>{{ customer.company }}</td>
|
|
1634
|
+
<td>{{ customer.representative.name }}</td>
|
|
1635
|
+
</tr>
|
|
1636
|
+
</ng-template>
|
|
1637
|
+
</p-table>
|
|
1638
|
+
<ng-template #footer>
|
|
1639
|
+
<p-button label="Ok" icon="pi pi-check" (onClick)="dialogVisible = false" />
|
|
1640
|
+
</ng-template>
|
|
1641
|
+
</p-dialog>
|
|
1642
|
+
</div>
|
|
1643
|
+
`,
|
|
1644
|
+
standalone: true,
|
|
1645
|
+
imports: [ButtonModule, DialogModule, TableModule],
|
|
1646
|
+
providers: [CustomerService]
|
|
1647
|
+
})
|
|
1648
|
+
export class TableFlexiblescrollDemo implements OnInit {
|
|
1649
|
+
private customerService = inject(CustomerService);
|
|
1650
|
+
customers!: Customer[];
|
|
1651
|
+
dialogVisible: boolean = false;
|
|
1652
|
+
|
|
1653
|
+
ngOnInit() {
|
|
1654
|
+
this.customerService.getCustomersMedium().then((data) => {
|
|
1655
|
+
this.customers = data;
|
|
1656
|
+
});
|
|
1657
|
+
}
|
|
1658
|
+
|
|
1659
|
+
showDialog() {
|
|
1660
|
+
this.dialogVisible = true;
|
|
1661
|
+
}
|
|
1662
|
+
}
|
|
1663
|
+
```
|
|
1664
|
+
|
|
1665
|
+
## frozencolumns-doc
|
|
1666
|
+
|
|
1667
|
+
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
|
+
|
|
1669
|
+
```typescript
|
|
1670
|
+
import { Component, OnInit, inject } from '@angular/core';
|
|
1671
|
+
import { FormsModule } from '@angular/forms';
|
|
1672
|
+
import { TableModule } from '@exhaustive-ui/core/table';
|
|
1673
|
+
import { ToggleButtonModule } from '@exhaustive-ui/core/togglebutton';
|
|
1674
|
+
import { CustomerService } from '@/service/customerservice';
|
|
1675
|
+
import { Customer, Representative, Country } from '@/domain/customer';
|
|
1676
|
+
|
|
1677
|
+
@Component({
|
|
1678
|
+
template: `
|
|
1679
|
+
<div class="card">
|
|
1680
|
+
<p-togglebutton [(ngModel)]="balanceFrozen" [onIcon]="'pi pi-lock'" offIcon="pi pi-lock-open" [onLabel]="'Balance'" offLabel="Balance" />
|
|
1681
|
+
<p-table [value]="customers" [scrollable]="true" scrollHeight="400px" class="mt-4">
|
|
1682
|
+
<ng-template #header>
|
|
1683
|
+
<tr>
|
|
1684
|
+
<th style="min-width:200px" pFrozenColumn class="font-bold">Name</th>
|
|
1685
|
+
<th style="min-width:100px">Id</th>
|
|
1686
|
+
<th style="min-width:200px">Country</th>
|
|
1687
|
+
<th style="min-width:200px">Date</th>
|
|
1688
|
+
<th style="min-width:200px">Company</th>
|
|
1689
|
+
<th style="min-width:200px">Status</th>
|
|
1690
|
+
<th style="min-width:200px">Activity</th>
|
|
1691
|
+
<th style="min-width:200px">Representative</th>
|
|
1692
|
+
<th style="min-width:200px" alignFrozen="right" pFrozenColumn [frozen]="balanceFrozen" [ngClass]="{ 'font-bold': balanceFrozen }">Balance</th>
|
|
1693
|
+
</tr>
|
|
1694
|
+
</ng-template>
|
|
1695
|
+
<ng-template #body let-customer>
|
|
1696
|
+
<tr>
|
|
1697
|
+
<td pFrozenColumn class="font-bold">{{ customer.name }}</td>
|
|
1698
|
+
<td style="min-width:100px">{{ customer.id }}</td>
|
|
1699
|
+
<td>{{ customer.country.name }}</td>
|
|
1700
|
+
<td>{{ customer.date }}</td>
|
|
1701
|
+
<td>{{ customer.company }}</td>
|
|
1702
|
+
<td>{{ customer.status }}</td>
|
|
1703
|
+
<td>{{ customer.activity }}</td>
|
|
1704
|
+
<td>{{ customer.representative.name }}</td>
|
|
1705
|
+
<td alignFrozen="right" pFrozenColumn [frozen]="balanceFrozen" [ngClass]="{ 'font-bold': balanceFrozen }">
|
|
1706
|
+
{{ formatCurrency(customer.balance) }}
|
|
1707
|
+
</td>
|
|
1708
|
+
</tr>
|
|
1709
|
+
</ng-template>
|
|
1710
|
+
</p-table>
|
|
1711
|
+
</div>
|
|
1712
|
+
`,
|
|
1713
|
+
standalone: true,
|
|
1714
|
+
imports: [TableModule, ToggleButtonModule, FormsModule],
|
|
1715
|
+
providers: [CustomerService]
|
|
1716
|
+
})
|
|
1717
|
+
export class TableFrozencolumnsDemo implements OnInit {
|
|
1718
|
+
private customerService = inject(CustomerService);
|
|
1719
|
+
balanceFrozen: boolean = false;
|
|
1720
|
+
customers!: Customer[];
|
|
1721
|
+
|
|
1722
|
+
ngOnInit() {
|
|
1723
|
+
this.customerService.getCustomersMedium().then((data) => {
|
|
1724
|
+
this.customers = data;
|
|
1725
|
+
});
|
|
1726
|
+
}
|
|
1727
|
+
|
|
1728
|
+
formatCurrency(value: number) {
|
|
1729
|
+
return value.toLocaleString('en-US', { style: 'currency', currency: 'USD' });
|
|
1730
|
+
}
|
|
1731
|
+
}
|
|
1732
|
+
```
|
|
1733
|
+
|
|
1734
|
+
## frozenrows-doc
|
|
1735
|
+
|
|
1736
|
+
Frozen rows are used to fix certain rows while scrolling, this data is defined with the frozenValue property.
|
|
1737
|
+
|
|
1738
|
+
```typescript
|
|
1739
|
+
import { Component, OnInit, inject } from '@angular/core';
|
|
1740
|
+
import { TableModule } from '@exhaustive-ui/core/table';
|
|
1741
|
+
import { ButtonModule } from '@exhaustive-ui/core/button';
|
|
1742
|
+
import { RippleModule } from '@exhaustive-ui/core/ripple';
|
|
1743
|
+
import { CustomerService } from '@/service/customerservice';
|
|
1744
|
+
import { Customer, Representative, Country } from '@/domain/customer';
|
|
1745
|
+
|
|
1746
|
+
@Component({
|
|
1747
|
+
template: `
|
|
1748
|
+
<div class="card">
|
|
1749
|
+
<p-table [value]="unlockedCustomers" [frozenValue]="lockedCustomers" [scrollable]="true" scrollHeight="400px" [tableStyle]="{ 'min-width': '60rem' }">
|
|
1750
|
+
<ng-template #header>
|
|
1751
|
+
<tr>
|
|
1752
|
+
<th>Name</th>
|
|
1753
|
+
<th>Country</th>
|
|
1754
|
+
<th>Company</th>
|
|
1755
|
+
<th>Representative</th>
|
|
1756
|
+
<th style="width:5rem"></th>
|
|
1757
|
+
</tr>
|
|
1758
|
+
</ng-template>
|
|
1759
|
+
<ng-template #frozenbody let-customer let-index="rowIndex">
|
|
1760
|
+
<tr class="font-bold">
|
|
1761
|
+
<td>{{ customer.name }}</td>
|
|
1762
|
+
<td>{{ customer.country.name }}</td>
|
|
1763
|
+
<td>{{ customer.company }}</td>
|
|
1764
|
+
<td>{{ customer.representative.name }}</td>
|
|
1765
|
+
<td>
|
|
1766
|
+
<button pButton pRipple type="button" [icon]="'pi pi-lock-open'" (click)="toggleLock(customer, true, index)" size="small" text></button>
|
|
1767
|
+
</td>
|
|
1768
|
+
</tr>
|
|
1769
|
+
</ng-template>
|
|
1770
|
+
<ng-template #body let-customer let-index="rowIndex">
|
|
1771
|
+
<tr>
|
|
1772
|
+
<td>{{ customer.name }}</td>
|
|
1773
|
+
<td>{{ customer.country.name }}</td>
|
|
1774
|
+
<td>{{ customer.company }}</td>
|
|
1775
|
+
<td>{{ customer.representative.name }}</td>
|
|
1776
|
+
<td>
|
|
1777
|
+
<button pButton pRipple type="button" [icon]="'pi pi-lock'" [disabled]="lockedCustomers.length >= 2" (click)="toggleLock(customer, false, index)" size="small" text></button>
|
|
1778
|
+
</td>
|
|
1779
|
+
</tr>
|
|
1780
|
+
</ng-template>
|
|
1781
|
+
</p-table>
|
|
1782
|
+
</div>
|
|
1783
|
+
`,
|
|
1784
|
+
standalone: true,
|
|
1785
|
+
imports: [TableModule, ButtonModule, RippleModule],
|
|
1786
|
+
providers: [CustomerService]
|
|
1787
|
+
})
|
|
1788
|
+
export class TableFrozenrowsDemo implements OnInit {
|
|
1789
|
+
private customerService = inject(CustomerService);
|
|
1790
|
+
unlockedCustomers!: Customer[];
|
|
1791
|
+
lockedCustomers!: Customer[];
|
|
1792
|
+
|
|
1793
|
+
ngOnInit() {
|
|
1794
|
+
this.customerService.getCustomersMedium().then((data) => {
|
|
1795
|
+
this.unlockedCustomers = data;
|
|
1796
|
+
});
|
|
1797
|
+
this.lockedCustomers = [
|
|
1798
|
+
{
|
|
1799
|
+
id: 5135,
|
|
1800
|
+
name: 'Geraldine Bisset',
|
|
1801
|
+
country: {
|
|
1802
|
+
name: 'France',
|
|
1803
|
+
code: 'fr'
|
|
1804
|
+
},
|
|
1805
|
+
company: 'Bisset Group',
|
|
1806
|
+
status: 'proposal',
|
|
1807
|
+
date: '2019-05-05',
|
|
1808
|
+
activity: 0,
|
|
1809
|
+
representative: {
|
|
1810
|
+
name: 'Amy Elsner',
|
|
1811
|
+
image: 'amyelsner.png'
|
|
1812
|
+
}
|
|
1813
|
+
}
|
|
1814
|
+
];
|
|
1815
|
+
}
|
|
1816
|
+
|
|
1817
|
+
toggleLock(data: Customer, frozen: boolean, index: number) {
|
|
1818
|
+
if (frozen) {
|
|
1819
|
+
this.lockedCustomers = this.lockedCustomers.filter((c, i) => i !== index);
|
|
1820
|
+
this.unlockedCustomers.push(data);
|
|
1821
|
+
} else {
|
|
1822
|
+
this.unlockedCustomers = this.unlockedCustomers.filter((c, i) => i !== index);
|
|
1823
|
+
this.lockedCustomers.push(data);
|
|
1824
|
+
}
|
|
1825
|
+
|
|
1826
|
+
this.unlockedCustomers.sort((val1, val2) => {
|
|
1827
|
+
return val1.id < val2.id ? -1 : 1;
|
|
1828
|
+
});
|
|
1829
|
+
}
|
|
1830
|
+
}
|
|
1831
|
+
```
|
|
1832
|
+
|
|
1833
|
+
## Grid Lines
|
|
1834
|
+
|
|
1835
|
+
Enabling showGridlines displays borders between cells.
|
|
1836
|
+
|
|
1837
|
+
```typescript
|
|
1838
|
+
import { Component, OnInit, inject } from '@angular/core';
|
|
1839
|
+
import { TableModule } from '@exhaustive-ui/core/table';
|
|
1840
|
+
import { ProductService } from '@/service/productservice';
|
|
1841
|
+
import { Product } from '@/domain/product';
|
|
1842
|
+
|
|
1843
|
+
@Component({
|
|
1844
|
+
template: `
|
|
1845
|
+
<div class="card">
|
|
1846
|
+
<p-table [value]="products" showGridlines [tableStyle]="{ 'min-width': '50rem' }">
|
|
1847
|
+
<ng-template #header>
|
|
1848
|
+
<tr>
|
|
1849
|
+
<th>Code</th>
|
|
1850
|
+
<th>Name</th>
|
|
1851
|
+
<th>Category</th>
|
|
1852
|
+
<th>Quantity</th>
|
|
1853
|
+
</tr>
|
|
1854
|
+
</ng-template>
|
|
1855
|
+
<ng-template #body let-product>
|
|
1856
|
+
<tr>
|
|
1857
|
+
<td>{{ product.code }}</td>
|
|
1858
|
+
<td>{{ product.name }}</td>
|
|
1859
|
+
<td>{{ product.category }}</td>
|
|
1860
|
+
<td>{{ product.quantity }}</td>
|
|
1861
|
+
</tr>
|
|
1862
|
+
</ng-template>
|
|
1863
|
+
</p-table>
|
|
1864
|
+
</div>
|
|
1865
|
+
`,
|
|
1866
|
+
standalone: true,
|
|
1867
|
+
imports: [TableModule],
|
|
1868
|
+
providers: [ProductService]
|
|
1869
|
+
})
|
|
1870
|
+
export class TableGridlinesDemo implements OnInit {
|
|
1871
|
+
private productService = inject(ProductService);
|
|
1872
|
+
products!: Product[];
|
|
1873
|
+
|
|
1874
|
+
ngOnInit() {
|
|
1875
|
+
this.productService.getProductsMini().then((data) => {
|
|
1876
|
+
this.products = data;
|
|
1877
|
+
});
|
|
1878
|
+
}
|
|
1879
|
+
}
|
|
1880
|
+
```
|
|
1881
|
+
|
|
1882
|
+
## horizontalscroll-doc
|
|
1883
|
+
|
|
1884
|
+
Horizontal scrollbar is displayed when table width exceeds the parent width.
|
|
1885
|
+
|
|
1886
|
+
```typescript
|
|
1887
|
+
import { Component, OnInit, inject } from '@angular/core';
|
|
1888
|
+
import { TableModule } from '@exhaustive-ui/core/table';
|
|
1889
|
+
import { CustomerService } from '@/service/customerservice';
|
|
1890
|
+
import { Customer, Representative, Country } from '@/domain/customer';
|
|
1891
|
+
|
|
1892
|
+
@Component({
|
|
1893
|
+
template: `
|
|
1894
|
+
<div class="card">
|
|
1895
|
+
<p-table [value]="customers" [scrollable]="true" scrollHeight="400px">
|
|
1896
|
+
<ng-template #header>
|
|
1897
|
+
<tr>
|
|
1898
|
+
<th style="min-width:100px">Id</th>
|
|
1899
|
+
<th style="min-width:200px">Name</th>
|
|
1900
|
+
<th style="min-width:200px">Country</th>
|
|
1901
|
+
<th style="min-width:200px">Date</th>
|
|
1902
|
+
<th style="min-width:200px">Balance</th>
|
|
1903
|
+
<th style="min-width:200px">Company</th>
|
|
1904
|
+
<th style="min-width:200px">Status</th>
|
|
1905
|
+
<th style="min-width:200px">Activity</th>
|
|
1906
|
+
<th style="min-width:200px">Representative</th>
|
|
1907
|
+
</tr>
|
|
1908
|
+
</ng-template>
|
|
1909
|
+
<ng-template #body let-customer>
|
|
1910
|
+
<tr>
|
|
1911
|
+
<td>{{ customer.id }}</td>
|
|
1912
|
+
<td>{{ customer.name }}</td>
|
|
1913
|
+
<td>{{ customer.country.name }}</td>
|
|
1914
|
+
<td>{{ customer.date }}</td>
|
|
1915
|
+
<td>{{ formatCurrency(customer.balance) }}</td>
|
|
1916
|
+
<td>{{ customer.company }}</td>
|
|
1917
|
+
<td>{{ customer.status }}</td>
|
|
1918
|
+
<td>{{ customer.activity }}</td>
|
|
1919
|
+
<td>{{ customer.representative.name }}</td>
|
|
1920
|
+
</tr>
|
|
1921
|
+
</ng-template>
|
|
1922
|
+
<ng-template #footer>
|
|
1923
|
+
<tr class="font-bold">
|
|
1924
|
+
<td>Id</td>
|
|
1925
|
+
<td>Name</td>
|
|
1926
|
+
<td>Country</td>
|
|
1927
|
+
<td>Date</td>
|
|
1928
|
+
<td>Balance</td>
|
|
1929
|
+
<td>Company</td>
|
|
1930
|
+
<td>Status</td>
|
|
1931
|
+
<td>Activity</td>
|
|
1932
|
+
<td>Representative</td>
|
|
1933
|
+
</tr>
|
|
1934
|
+
</ng-template>
|
|
1935
|
+
</p-table>
|
|
1936
|
+
</div>
|
|
1937
|
+
`,
|
|
1938
|
+
standalone: true,
|
|
1939
|
+
imports: [TableModule],
|
|
1940
|
+
providers: [CustomerService]
|
|
1941
|
+
})
|
|
1942
|
+
export class TableHorizontalscrollDemo implements OnInit {
|
|
1943
|
+
private customerService = inject(CustomerService);
|
|
1944
|
+
customers!: Customer[];
|
|
1945
|
+
|
|
1946
|
+
ngOnInit() {
|
|
1947
|
+
this.customerService.getCustomersMedium().then((data) => {
|
|
1948
|
+
this.customers = data;
|
|
1949
|
+
});
|
|
1950
|
+
}
|
|
1951
|
+
|
|
1952
|
+
formatCurrency(value: number) {
|
|
1953
|
+
return value.toLocaleString('en-US', { style: 'currency', currency: 'USD' });
|
|
1954
|
+
}
|
|
1955
|
+
}
|
|
1956
|
+
```
|
|
1957
|
+
|
|
1958
|
+
## loadingmask-doc
|
|
1959
|
+
|
|
1960
|
+
The loading property displays a mask layer to indicate busy state. Use the paginator to display the mask.
|
|
1961
|
+
|
|
1962
|
+
```typescript
|
|
1963
|
+
import { Component, OnInit, inject } from '@angular/core';
|
|
1964
|
+
import { TableModule } from '@exhaustive-ui/core/table';
|
|
1965
|
+
import { ProductService } from '@/service/productservice';
|
|
1966
|
+
import { Product } from '@/domain/product';
|
|
1967
|
+
|
|
1968
|
+
@Component({
|
|
1969
|
+
template: `
|
|
1970
|
+
<div class="card">
|
|
1971
|
+
<p-table [value]="products" [tableStyle]="{ 'min-width': '50rem' }" [loading]="true">
|
|
1972
|
+
<ng-template #header>
|
|
1973
|
+
<tr>
|
|
1974
|
+
<th style="width:25%">Code</th>
|
|
1975
|
+
<th style="width:25%">Name</th>
|
|
1976
|
+
<th style="width:25%">Category</th>
|
|
1977
|
+
<th style="width:25%">Quantity</th>
|
|
1978
|
+
</tr>
|
|
1979
|
+
</ng-template>
|
|
1980
|
+
<ng-template #body let-product>
|
|
1981
|
+
<tr>
|
|
1982
|
+
<td>{{ product.code }}</td>
|
|
1983
|
+
<td>{{ product.name }}</td>
|
|
1984
|
+
<td>{{ product.category }}</td>
|
|
1985
|
+
<td>{{ product.quantity }}</td>
|
|
1986
|
+
</tr>
|
|
1987
|
+
</ng-template>
|
|
1988
|
+
</p-table>
|
|
1989
|
+
</div>
|
|
1990
|
+
`,
|
|
1991
|
+
standalone: true,
|
|
1992
|
+
imports: [TableModule],
|
|
1993
|
+
providers: [ProductService]
|
|
1994
|
+
})
|
|
1995
|
+
export class TableLoadingmaskDemo implements OnInit {
|
|
1996
|
+
private productService = inject(ProductService);
|
|
1997
|
+
products!: Product[];
|
|
1998
|
+
|
|
1999
|
+
ngOnInit() {
|
|
2000
|
+
this.productService.getProductsMini().then((data) => {
|
|
2001
|
+
this.products = data;
|
|
2002
|
+
});
|
|
2003
|
+
}
|
|
2004
|
+
}
|
|
2005
|
+
```
|
|
2006
|
+
|
|
2007
|
+
## loadingskeleton-doc
|
|
2008
|
+
|
|
2009
|
+
Skeleton component can be used as a placeholder during the loading process.
|
|
2010
|
+
|
|
2011
|
+
```typescript
|
|
2012
|
+
import { Component, OnInit } from '@angular/core';
|
|
2013
|
+
import { SkeletonModule } from '@exhaustive-ui/core/skeleton';
|
|
2014
|
+
import { TableModule } from '@exhaustive-ui/core/table';
|
|
2015
|
+
import { Product } from '@/domain/product';
|
|
2016
|
+
|
|
2017
|
+
@Component({
|
|
2018
|
+
template: `
|
|
2019
|
+
<div class="card">
|
|
2020
|
+
<p-table [value]="products" [tableStyle]="{ 'min-width': '50rem' }">
|
|
2021
|
+
<ng-template #header>
|
|
2022
|
+
<tr>
|
|
2023
|
+
<th>Code</th>
|
|
2024
|
+
<th>Name</th>
|
|
2025
|
+
<th>Category</th>
|
|
2026
|
+
<th>Quantity</th>
|
|
2027
|
+
</tr>
|
|
2028
|
+
</ng-template>
|
|
2029
|
+
<ng-template #body let-product>
|
|
2030
|
+
<tr>
|
|
2031
|
+
<td><p-skeleton /></td>
|
|
2032
|
+
<td><p-skeleton /></td>
|
|
2033
|
+
<td><p-skeleton /></td>
|
|
2034
|
+
<td><p-skeleton /></td>
|
|
2035
|
+
</tr>
|
|
2036
|
+
</ng-template>
|
|
2037
|
+
</p-table>
|
|
2038
|
+
</div>
|
|
2039
|
+
`,
|
|
2040
|
+
standalone: true,
|
|
2041
|
+
imports: [SkeletonModule, TableModule]
|
|
2042
|
+
})
|
|
2043
|
+
export class TableLoadingskeletonDemo implements OnInit {
|
|
2044
|
+
products!: Product[];
|
|
2045
|
+
|
|
2046
|
+
ngOnInit() {
|
|
2047
|
+
this.products = Array.from({ length: 10 }).map((_, i) => ({ id: i.toString() }));
|
|
2048
|
+
}
|
|
2049
|
+
}
|
|
2050
|
+
```
|
|
2051
|
+
|
|
2052
|
+
## multiplecolumnssort-doc
|
|
2053
|
+
|
|
2054
|
+
Multiple columns can be sorted by defining sortMode as multiple . This mode requires metaKey (e.g. ⌘ ) to be pressed when clicking a header.
|
|
2055
|
+
|
|
2056
|
+
```typescript
|
|
2057
|
+
import { Component, OnInit, inject } from '@angular/core';
|
|
2058
|
+
import { TableModule } from '@exhaustive-ui/core/table';
|
|
2059
|
+
import { ProductService } from '@/service/productservice';
|
|
2060
|
+
import { Product } from '@/domain/product';
|
|
2061
|
+
|
|
2062
|
+
@Component({
|
|
2063
|
+
template: `
|
|
2064
|
+
<div class="card">
|
|
2065
|
+
<p-table [value]="products" [tableStyle]="{ 'min-width': '60rem' }" sortMode="multiple">
|
|
2066
|
+
<ng-template #header>
|
|
2067
|
+
<tr>
|
|
2068
|
+
<th pSortableColumn="code" style="width:20%">
|
|
2069
|
+
<div class="flex items-center gap-2">
|
|
2070
|
+
Code
|
|
2071
|
+
<p-sortIcon field="code" />
|
|
2072
|
+
</div>
|
|
2073
|
+
</th>
|
|
2074
|
+
<th pSortableColumn="name" style="width:20%">
|
|
2075
|
+
<div class="flex items-center gap-2">
|
|
2076
|
+
Name
|
|
2077
|
+
<p-sortIcon field="name" />
|
|
2078
|
+
</div>
|
|
2079
|
+
</th>
|
|
2080
|
+
<th pSortableColumn="category" style="width:20%">
|
|
2081
|
+
<div class="flex items-center gap-2">
|
|
2082
|
+
Category
|
|
2083
|
+
<p-sortIcon field="category" />
|
|
2084
|
+
</div>
|
|
2085
|
+
</th>
|
|
2086
|
+
<th pSortableColumn="quantity" style="width:20%">
|
|
2087
|
+
<div class="flex items-center gap-2">
|
|
2088
|
+
Quantity
|
|
2089
|
+
<p-sortIcon field="quantity" />
|
|
2090
|
+
</div>
|
|
2091
|
+
</th>
|
|
2092
|
+
</tr>
|
|
2093
|
+
</ng-template>
|
|
2094
|
+
<ng-template #body let-product>
|
|
2095
|
+
<tr>
|
|
2096
|
+
<td>{{ product.code }}</td>
|
|
2097
|
+
<td>{{ product.name }}</td>
|
|
2098
|
+
<td>{{ product.category }}</td>
|
|
2099
|
+
<td>{{ product.quantity }}</td>
|
|
2100
|
+
</tr>
|
|
2101
|
+
</ng-template>
|
|
2102
|
+
</p-table>
|
|
2103
|
+
</div>
|
|
2104
|
+
`,
|
|
2105
|
+
standalone: true,
|
|
2106
|
+
imports: [TableModule],
|
|
2107
|
+
providers: [ProductService]
|
|
2108
|
+
})
|
|
2109
|
+
export class TableMultiplecolumnssortDemo implements OnInit {
|
|
2110
|
+
private productService = inject(ProductService);
|
|
2111
|
+
products: Product[];
|
|
2112
|
+
|
|
2113
|
+
ngOnInit() {
|
|
2114
|
+
this.productService.getProductsMini().then((data) => {
|
|
2115
|
+
this.products = data;
|
|
2116
|
+
});
|
|
2117
|
+
}
|
|
2118
|
+
}
|
|
2119
|
+
```
|
|
2120
|
+
|
|
2121
|
+
## multipleselection-doc
|
|
2122
|
+
|
|
2123
|
+
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
|
+
|
|
2125
|
+
```typescript
|
|
2126
|
+
import { Component, OnInit, inject } from '@angular/core';
|
|
2127
|
+
import { FormsModule } from '@angular/forms';
|
|
2128
|
+
import { TableModule } from '@exhaustive-ui/core/table';
|
|
2129
|
+
import { ToggleSwitchModule } from '@exhaustive-ui/core/toggleswitch';
|
|
2130
|
+
import { ProductService } from '@/service/productservice';
|
|
2131
|
+
import { Product } from '@/domain/product';
|
|
2132
|
+
|
|
2133
|
+
@Component({
|
|
2134
|
+
template: `
|
|
2135
|
+
<div class="card">
|
|
2136
|
+
<div class="flex justify-center items-center mb-6 gap-2">
|
|
2137
|
+
<p-toggleswitch [(ngModel)]="metaKey" inputId="input-metakey" />
|
|
2138
|
+
<label for="input-metakey">MetaKey</label>
|
|
2139
|
+
</div>
|
|
2140
|
+
<p-table [value]="products" selectionMode="multiple" [(selection)]="selectedProducts" [metaKeySelection]="metaKey" dataKey="code" [tableStyle]="{ 'min-width': '50rem' }">
|
|
2141
|
+
<ng-template #header>
|
|
2142
|
+
<tr>
|
|
2143
|
+
<th>Code</th>
|
|
2144
|
+
<th>Name</th>
|
|
2145
|
+
<th>Category</th>
|
|
2146
|
+
<th>Quantity</th>
|
|
2147
|
+
</tr>
|
|
2148
|
+
</ng-template>
|
|
2149
|
+
<ng-template #body let-product let-rowIndex="rowIndex">
|
|
2150
|
+
<tr [pSelectableRow]="product" [pSelectableRowIndex]="rowIndex">
|
|
2151
|
+
<td>{{ product.code }}</td>
|
|
2152
|
+
<td>{{ product.name }}</td>
|
|
2153
|
+
<td>{{ product.category }}</td>
|
|
2154
|
+
<td>{{ product.quantity }}</td>
|
|
2155
|
+
</tr>
|
|
2156
|
+
</ng-template>
|
|
2157
|
+
</p-table>
|
|
2158
|
+
</div>
|
|
2159
|
+
`,
|
|
2160
|
+
standalone: true,
|
|
2161
|
+
imports: [TableModule, ToggleSwitchModule, FormsModule],
|
|
2162
|
+
providers: [ProductService]
|
|
2163
|
+
})
|
|
2164
|
+
export class TableMultipleselectionDemo implements OnInit {
|
|
2165
|
+
private productService = inject(ProductService);
|
|
2166
|
+
products!: Product[];
|
|
2167
|
+
selectedProducts!: Product;
|
|
2168
|
+
metaKey: boolean = true;
|
|
2169
|
+
|
|
2170
|
+
ngOnInit() {
|
|
2171
|
+
this.productService.getProductsMini().then((data) => {
|
|
2172
|
+
this.products = data;
|
|
2173
|
+
});
|
|
2174
|
+
}
|
|
2175
|
+
}
|
|
2176
|
+
```
|
|
2177
|
+
|
|
2178
|
+
## paginatorbasic-doc
|
|
2179
|
+
|
|
2180
|
+
Pagination is enabled by setting paginator property to true and defining a rows property to specify the number of rows per page.
|
|
2181
|
+
|
|
2182
|
+
```typescript
|
|
2183
|
+
import { Component, OnInit, inject } from '@angular/core';
|
|
2184
|
+
import { TableModule } from '@exhaustive-ui/core/table';
|
|
2185
|
+
import { CustomerService } from '@/service/customerservice';
|
|
2186
|
+
import { Customer, Representative, Country } from '@/domain/customer';
|
|
2187
|
+
|
|
2188
|
+
@Component({
|
|
2189
|
+
template: `
|
|
2190
|
+
<div class="card">
|
|
2191
|
+
<p-table [value]="customers" [paginator]="true" [rows]="5" [tableStyle]="{ 'min-width': '50rem' }" [rowsPerPageOptions]="[5, 10, 20]">
|
|
2192
|
+
<ng-template #header>
|
|
2193
|
+
<tr>
|
|
2194
|
+
<th style="width:25%">Name</th>
|
|
2195
|
+
<th style="width:25%">Country</th>
|
|
2196
|
+
<th style="width:25%">Company</th>
|
|
2197
|
+
<th style="width:25%">Representative</th>
|
|
2198
|
+
</tr>
|
|
2199
|
+
</ng-template>
|
|
2200
|
+
<ng-template #body let-customer>
|
|
2201
|
+
<tr>
|
|
2202
|
+
<td>{{ customer.name }}</td>
|
|
2203
|
+
<td>{{ customer.country.name }}</td>
|
|
2204
|
+
<td>{{ customer.company }}</td>
|
|
2205
|
+
<td>{{ customer.representative.name }}</td>
|
|
2206
|
+
</tr>
|
|
2207
|
+
</ng-template>
|
|
2208
|
+
</p-table>
|
|
2209
|
+
</div>
|
|
2210
|
+
`,
|
|
2211
|
+
standalone: true,
|
|
2212
|
+
imports: [TableModule],
|
|
2213
|
+
providers: [CustomerService]
|
|
2214
|
+
})
|
|
2215
|
+
export class TablePaginatorbasicDemo implements OnInit {
|
|
2216
|
+
private customerService = inject(CustomerService);
|
|
2217
|
+
customers!: Customer[];
|
|
2218
|
+
|
|
2219
|
+
ngOnInit() {
|
|
2220
|
+
this.customerService.getCustomersLarge().then((customers) => {
|
|
2221
|
+
this.customers = customers;
|
|
2222
|
+
});
|
|
2223
|
+
}
|
|
2224
|
+
}
|
|
2225
|
+
```
|
|
2226
|
+
|
|
2227
|
+
## paginatorprogrammatic-doc
|
|
2228
|
+
|
|
2229
|
+
Paginator can also be controlled via model using a binding to the first property where changes trigger a pagination.
|
|
2230
|
+
|
|
2231
|
+
```typescript
|
|
2232
|
+
import { Component, OnInit, inject } from '@angular/core';
|
|
2233
|
+
import { ButtonModule } from '@exhaustive-ui/core/button';
|
|
2234
|
+
import { TableModule } from '@exhaustive-ui/core/table';
|
|
2235
|
+
import { CustomerService } from '@/service/customerservice';
|
|
2236
|
+
import { Customer, Representative, Country } from '@/domain/customer';
|
|
2237
|
+
|
|
2238
|
+
@Component({
|
|
2239
|
+
template: `
|
|
2240
|
+
<div class="card">
|
|
2241
|
+
<div class="mb-4 flex gap-1">
|
|
2242
|
+
<p-button type="button" icon="pi pi-chevron-left" (click)="prev()" [disabled]="isFirstPage()" text />
|
|
2243
|
+
<p-button type="button" icon="pi pi-refresh" (click)="reset()" text />
|
|
2244
|
+
<p-button type="button" icon="pi pi-chevron-right" (click)="next()" [disabled]="isLastPage()" text />
|
|
2245
|
+
</div>
|
|
2246
|
+
<p-table
|
|
2247
|
+
[value]="customers"
|
|
2248
|
+
[paginator]="true"
|
|
2249
|
+
[rows]="rows"
|
|
2250
|
+
[showCurrentPageReport]="true"
|
|
2251
|
+
[first]="first"
|
|
2252
|
+
[tableStyle]="{ 'min-width': '50rem' }"
|
|
2253
|
+
currentPageReportTemplate="Showing {first} to {last} of {totalRecords} entries"
|
|
2254
|
+
(onPage)="pageChange($event)"
|
|
2255
|
+
[rowsPerPageOptions]="[10, 25, 50]"
|
|
2256
|
+
>
|
|
2257
|
+
<ng-template #header>
|
|
2258
|
+
<tr>
|
|
2259
|
+
<th style="width:25%">Name</th>
|
|
2260
|
+
<th style="width:25%">Country</th>
|
|
2261
|
+
<th style="width:25%">Company</th>
|
|
2262
|
+
<th style="width:25%">Representative</th>
|
|
2263
|
+
</tr>
|
|
2264
|
+
</ng-template>
|
|
2265
|
+
<ng-template #body let-customer>
|
|
2266
|
+
<tr>
|
|
2267
|
+
<td>{{ customer.name }}</td>
|
|
2268
|
+
<td>{{ customer.country.name }}</td>
|
|
2269
|
+
<td>{{ customer.company }}</td>
|
|
2270
|
+
<td>{{ customer.representative.name }}</td>
|
|
2271
|
+
</tr>
|
|
2272
|
+
</ng-template>
|
|
2273
|
+
</p-table>
|
|
2274
|
+
</div>
|
|
2275
|
+
`,
|
|
2276
|
+
standalone: true,
|
|
2277
|
+
imports: [ButtonModule, TableModule],
|
|
2278
|
+
providers: [CustomerService]
|
|
2279
|
+
})
|
|
2280
|
+
export class TablePaginatorprogrammaticDemo implements OnInit {
|
|
2281
|
+
private customerService = inject(CustomerService);
|
|
2282
|
+
customers!: Customer[];
|
|
2283
|
+
first: number = 0;
|
|
2284
|
+
rows: number = 10;
|
|
2285
|
+
|
|
2286
|
+
ngOnInit() {
|
|
2287
|
+
this.customerService.getCustomersLarge().then((customers) => {
|
|
2288
|
+
this.customers = customers;
|
|
2289
|
+
});
|
|
2290
|
+
}
|
|
2291
|
+
|
|
2292
|
+
next() {
|
|
2293
|
+
this.first = this.first + this.rows;
|
|
2294
|
+
}
|
|
2295
|
+
|
|
2296
|
+
prev() {
|
|
2297
|
+
this.first = this.first - this.rows;
|
|
2298
|
+
}
|
|
2299
|
+
|
|
2300
|
+
reset() {
|
|
2301
|
+
this.first = 0;
|
|
2302
|
+
}
|
|
2303
|
+
|
|
2304
|
+
pageChange(event) {
|
|
2305
|
+
this.first = event.first;
|
|
2306
|
+
this.rows = event.rows;
|
|
2307
|
+
}
|
|
2308
|
+
|
|
2309
|
+
isLastPage(): boolean {
|
|
2310
|
+
return this.customers ? this.first + this.rows >= this.customers.length : true;
|
|
2311
|
+
}
|
|
2312
|
+
|
|
2313
|
+
isFirstPage(): boolean {
|
|
2314
|
+
return this.customers ? this.first === 0 : true;
|
|
2315
|
+
}
|
|
2316
|
+
}
|
|
2317
|
+
```
|
|
2318
|
+
|
|
2319
|
+
## presort-doc
|
|
2320
|
+
|
|
2321
|
+
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
|
+
|
|
2323
|
+
```typescript
|
|
2324
|
+
import { Component, OnInit, inject } from '@angular/core';
|
|
2325
|
+
import { TableModule } from '@exhaustive-ui/core/table';
|
|
2326
|
+
import { ProductService } from '@/service/productservice';
|
|
2327
|
+
import { Product } from '@/domain/product';
|
|
2328
|
+
|
|
2329
|
+
@Component({
|
|
2330
|
+
template: `
|
|
2331
|
+
<div class="card">
|
|
2332
|
+
<p-table [value]="products" sortField="price" [sortOrder]="-1" [tableStyle]="{ 'min-width': '60rem' }">
|
|
2333
|
+
<ng-template #header>
|
|
2334
|
+
<tr>
|
|
2335
|
+
<th pSortableColumn="code" style="width:20%">
|
|
2336
|
+
<div class="flex items-center gap-2">
|
|
2337
|
+
Code
|
|
2338
|
+
<p-sortIcon field="code" />
|
|
2339
|
+
</div>
|
|
2340
|
+
</th>
|
|
2341
|
+
<th pSortableColumn="name" style="width:20%">
|
|
2342
|
+
<div class="flex items-center gap-2">
|
|
2343
|
+
Name
|
|
2344
|
+
<p-sortIcon field="name" />
|
|
2345
|
+
</div>
|
|
2346
|
+
</th>
|
|
2347
|
+
<th pSortableColumn="price" style="width:20%">
|
|
2348
|
+
<div class="flex items-center gap-2">
|
|
2349
|
+
Price
|
|
2350
|
+
<p-sortIcon field="price" />
|
|
2351
|
+
</div>
|
|
2352
|
+
</th>
|
|
2353
|
+
<th pSortableColumn="category" style="width:20%">
|
|
2354
|
+
<div class="flex items-center gap-2">
|
|
2355
|
+
Category
|
|
2356
|
+
<p-sortIcon field="category" />
|
|
2357
|
+
</div>
|
|
2358
|
+
</th>
|
|
2359
|
+
<th pSortableColumn="quantity" style="width:20%">
|
|
2360
|
+
<div class="flex items-center gap-2">
|
|
2361
|
+
Quantity
|
|
2362
|
+
<p-sortIcon field="quantity" />
|
|
2363
|
+
</div>
|
|
2364
|
+
</th>
|
|
2365
|
+
</tr>
|
|
2366
|
+
</ng-template>
|
|
2367
|
+
<ng-template #body let-product>
|
|
2368
|
+
<tr>
|
|
2369
|
+
<td>{{ product.code }}</td>
|
|
2370
|
+
<td>{{ product.name }}</td>
|
|
2371
|
+
<td>{{ product.price | currency: 'USD' }}</td>
|
|
2372
|
+
<td>{{ product.category }}</td>
|
|
2373
|
+
<td>{{ product.quantity }}</td>
|
|
2374
|
+
</tr>
|
|
2375
|
+
</ng-template>
|
|
2376
|
+
</p-table>
|
|
2377
|
+
</div>
|
|
2378
|
+
`,
|
|
2379
|
+
standalone: true,
|
|
2380
|
+
imports: [TableModule],
|
|
2381
|
+
providers: [ProductService]
|
|
2382
|
+
})
|
|
2383
|
+
export class TablePresortDemo implements OnInit {
|
|
2384
|
+
private productService = inject(ProductService);
|
|
2385
|
+
products!: Product[];
|
|
2386
|
+
|
|
2387
|
+
ngOnInit() {
|
|
2388
|
+
this.productService.getProductsMini().then((data) => {
|
|
2389
|
+
this.products = data;
|
|
2390
|
+
});
|
|
2391
|
+
}
|
|
2392
|
+
}
|
|
2393
|
+
```
|
|
2394
|
+
|
|
2395
|
+
## Products
|
|
2396
|
+
|
|
2397
|
+
CRUD implementation example with a Dialog.
|
|
2398
|
+
|
|
2399
|
+
```typescript
|
|
2400
|
+
import { Component, OnInit, inject } from '@angular/core';
|
|
2401
|
+
import { FormsModule } from '@angular/forms';
|
|
2402
|
+
import { ButtonModule } from '@exhaustive-ui/core/button';
|
|
2403
|
+
import { ConfirmDialogModule } from '@exhaustive-ui/core/confirmdialog';
|
|
2404
|
+
import { Dialog, DialogModule } from '@exhaustive-ui/core/dialog';
|
|
2405
|
+
import { SelectModule } from '@exhaustive-ui/core/select';
|
|
2406
|
+
import { FileUploadModule } from '@exhaustive-ui/core/fileupload';
|
|
2407
|
+
import { IconFieldModule } from '@exhaustive-ui/core/iconfield';
|
|
2408
|
+
import { InputIconModule } from '@exhaustive-ui/core/inputicon';
|
|
2409
|
+
import { InputNumberModule } from '@exhaustive-ui/core/inputnumber';
|
|
2410
|
+
import { RadioButtonModule } from '@exhaustive-ui/core/radiobutton';
|
|
2411
|
+
import { RatingModule } from '@exhaustive-ui/core/rating';
|
|
2412
|
+
import { Table, TableModule } from '@exhaustive-ui/core/table';
|
|
2413
|
+
import { TagModule } from '@exhaustive-ui/core/tag';
|
|
2414
|
+
import { ToastModule } from '@exhaustive-ui/core/toast';
|
|
2415
|
+
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
|
+
import { Product } from '@/domain/product';
|
|
2420
|
+
|
|
2421
|
+
interface Column {
|
|
2422
|
+
field: string;
|
|
2423
|
+
header: string;
|
|
2424
|
+
customExportHeader?: string;
|
|
2425
|
+
}
|
|
2426
|
+
|
|
2427
|
+
interface ExportColumn {
|
|
2428
|
+
title: string;
|
|
2429
|
+
dataKey: string;
|
|
2430
|
+
}
|
|
2431
|
+
|
|
2432
|
+
@Component({
|
|
2433
|
+
template: `
|
|
2434
|
+
<div class="card">
|
|
2435
|
+
<p-toast />
|
|
2436
|
+
<p-toolbar class="mb-6">
|
|
2437
|
+
<ng-template #start>
|
|
2438
|
+
<p-button label="New" icon="pi pi-plus" class="mr-2" (onClick)="openNew()" />
|
|
2439
|
+
<p-button severity="danger" label="Delete" icon="pi pi-trash" outlined (onClick)="deleteSelectedProducts()" [disabled]="!selectedProducts || !selectedProducts.length" />
|
|
2440
|
+
</ng-template>
|
|
2441
|
+
<ng-template #end>
|
|
2442
|
+
<p-fileUpload mode="basic" accept="image/*" [maxFileSize]="1000000" label="Import" chooseLabel="Import" auto customUpload class="mr-2 inline-block" [chooseButtonProps]="{ severity: 'secondary' }" />
|
|
2443
|
+
<p-button label="Export" icon="pi pi-upload" severity="secondary" (onClick)="exportCSV($event)" />
|
|
2444
|
+
</ng-template>
|
|
2445
|
+
</p-toolbar>
|
|
2446
|
+
<p-table
|
|
2447
|
+
#dt
|
|
2448
|
+
[value]="products"
|
|
2449
|
+
[rows]="10"
|
|
2450
|
+
[columns]="cols"
|
|
2451
|
+
[paginator]="true"
|
|
2452
|
+
[globalFilterFields]="['name', 'country.name', 'representative.name', 'status']"
|
|
2453
|
+
[tableStyle]="{ 'min-width': '75rem' }"
|
|
2454
|
+
[(selection)]="selectedProducts"
|
|
2455
|
+
[rowHover]="true"
|
|
2456
|
+
dataKey="id"
|
|
2457
|
+
currentPageReportTemplate="Showing {first} to {last} of {totalRecords} entries"
|
|
2458
|
+
[showCurrentPageReport]="true"
|
|
2459
|
+
>
|
|
2460
|
+
<ng-template #caption>
|
|
2461
|
+
<div class="flex items-center justify-between">
|
|
2462
|
+
<h5 class="m-0">Manage Products</h5>
|
|
2463
|
+
<p-iconfield>
|
|
2464
|
+
<p-inputicon class="pi pi-search" />
|
|
2465
|
+
<input pInputText type="text" (input)="dt.filterGlobal($event.target.value, 'contains')" placeholder="Search..." />
|
|
2466
|
+
</p-iconfield>
|
|
2467
|
+
</div>
|
|
2468
|
+
</ng-template>
|
|
2469
|
+
<ng-template #header>
|
|
2470
|
+
<tr>
|
|
2471
|
+
<th style="width: 3rem">
|
|
2472
|
+
<p-tableHeaderCheckbox />
|
|
2473
|
+
</th>
|
|
2474
|
+
<th style="min-width: 16rem">Code</th>
|
|
2475
|
+
<th pSortableColumn="name" style="min-width:16rem">
|
|
2476
|
+
<div class="flex items-center gap-2">
|
|
2477
|
+
Name
|
|
2478
|
+
<p-sortIcon field="name" />
|
|
2479
|
+
</div>
|
|
2480
|
+
</th>
|
|
2481
|
+
<th>Image</th>
|
|
2482
|
+
<th pSortableColumn="price" style="min-width: 8rem">
|
|
2483
|
+
<div class="flex items-center gap-2">
|
|
2484
|
+
Price
|
|
2485
|
+
<p-sortIcon field="price" />
|
|
2486
|
+
</div>
|
|
2487
|
+
</th>
|
|
2488
|
+
<th pSortableColumn="category" style="min-width:10rem">
|
|
2489
|
+
<div class="flex items-center gap-2">
|
|
2490
|
+
Category
|
|
2491
|
+
<p-sortIcon field="category" />
|
|
2492
|
+
</div>
|
|
2493
|
+
</th>
|
|
2494
|
+
<th pSortableColumn="rating" style="min-width: 12rem">
|
|
2495
|
+
<div class="flex items-center gap-2">
|
|
2496
|
+
Reviews
|
|
2497
|
+
<p-sortIcon field="rating" />
|
|
2498
|
+
</div>
|
|
2499
|
+
</th>
|
|
2500
|
+
<th pSortableColumn="inventoryStatus" style="min-width: 12rem">
|
|
2501
|
+
<div class="flex items-center gap-2">
|
|
2502
|
+
Status
|
|
2503
|
+
<p-sortIcon field="inventoryStatus" />
|
|
2504
|
+
</div>
|
|
2505
|
+
</th>
|
|
2506
|
+
<th style="min-width: 12rem"></th>
|
|
2507
|
+
</tr>
|
|
2508
|
+
</ng-template>
|
|
2509
|
+
<ng-template #body let-product>
|
|
2510
|
+
<tr>
|
|
2511
|
+
<td style="width: 3rem">
|
|
2512
|
+
<p-tableCheckbox [value]="product" />
|
|
2513
|
+
</td>
|
|
2514
|
+
<td style="min-width: 12rem">{{ product.code }}</td>
|
|
2515
|
+
<td style="min-width: 16rem">{{ product.name }}</td>
|
|
2516
|
+
<td>
|
|
2517
|
+
<img [src]="'https://exhaustive-ui.e-xiste.com/demo/product/' + product.image" [alt]="product.name" style="width: 64px" class="rounded" />
|
|
2518
|
+
</td>
|
|
2519
|
+
<td>{{ product.price | currency: 'USD' }}</td>
|
|
2520
|
+
<td>{{ product.category }}</td>
|
|
2521
|
+
<td>
|
|
2522
|
+
<p-rating [(ngModel)]="product.rating" [readonly]="true" />
|
|
2523
|
+
</td>
|
|
2524
|
+
<td>
|
|
2525
|
+
<p-tag [value]="product.inventoryStatus" [severity]="getSeverity(product.inventoryStatus)" />
|
|
2526
|
+
</td>
|
|
2527
|
+
<td>
|
|
2528
|
+
<p-button icon="pi pi-pencil" class="mr-2" [rounded]="true" [outlined]="true" (click)="editProduct(product)" />
|
|
2529
|
+
<p-button icon="pi pi-trash" severity="danger" [rounded]="true" [outlined]="true" (click)="deleteProduct(product)" />
|
|
2530
|
+
</td>
|
|
2531
|
+
</tr>
|
|
2532
|
+
</ng-template>
|
|
2533
|
+
</p-table>
|
|
2534
|
+
<p-dialog [(visible)]="productDialog" [style]="{ width: '450px' }" header="Product Details" [modal]="true">
|
|
2535
|
+
<ng-template #content>
|
|
2536
|
+
<div class="flex flex-col gap-6">
|
|
2537
|
+
<img [src]="'https://exhaustive-ui.e-xiste.com/demo/product/' + product.image" [alt]="product.image" class="block m-auto pb-4" *ngIf="product.image" />
|
|
2538
|
+
<div>
|
|
2539
|
+
<label for="name" class="block font-bold mb-3">Name</label>
|
|
2540
|
+
<input type="text" pInputText id="name" [(ngModel)]="product.name" required autofocus fluid />
|
|
2541
|
+
<small class="text-red-500" *ngIf="submitted && !product.name">Name is required.</small>
|
|
2542
|
+
</div>
|
|
2543
|
+
<div>
|
|
2544
|
+
<label for="description" class="block font-bold mb-3">Description</label>
|
|
2545
|
+
<textarea id="description" pTextarea [(ngModel)]="product.description" required rows="3" cols="20" fluid></textarea>
|
|
2546
|
+
</div>
|
|
2547
|
+
<div>
|
|
2548
|
+
<label for="inventoryStatus" class="block font-bold mb-3">Inventory Status</label>
|
|
2549
|
+
<p-select [(ngModel)]="product.inventoryStatus" inputId="inventoryStatus" [options]="statuses" optionLabel="label" optionValue="label" placeholder="Select a Status" fluid />
|
|
2550
|
+
</div>
|
|
2551
|
+
<div>
|
|
2552
|
+
<span class="block font-bold mb-4">Category</span>
|
|
2553
|
+
<div class="grid grid-cols-12 gap-4">
|
|
2554
|
+
<div class="flex items-center gap-2 col-span-6">
|
|
2555
|
+
<p-radiobutton id="category1" name="category" value="Accessories" [(ngModel)]="product.category" />
|
|
2556
|
+
<label for="category1">Accessories</label>
|
|
2557
|
+
</div>
|
|
2558
|
+
<div class="flex items-center gap-2 col-span-6">
|
|
2559
|
+
<p-radiobutton id="category2" name="category" value="Clothing" [(ngModel)]="product.category" />
|
|
2560
|
+
<label for="category2">Clothing</label>
|
|
2561
|
+
</div>
|
|
2562
|
+
<div class="flex items-center gap-2 col-span-6">
|
|
2563
|
+
<p-radiobutton id="category3" name="category" value="Electronics" [(ngModel)]="product.category" />
|
|
2564
|
+
<label for="category3">Electronics</label>
|
|
2565
|
+
</div>
|
|
2566
|
+
<div class="flex items-center gap-2 col-span-6">
|
|
2567
|
+
<p-radiobutton id="category4" name="category" value="Fitness" [(ngModel)]="product.category" />
|
|
2568
|
+
<label for="category4">Fitness</label>
|
|
2569
|
+
</div>
|
|
2570
|
+
</div>
|
|
2571
|
+
</div>
|
|
2572
|
+
<div class="grid grid-cols-12 gap-4">
|
|
2573
|
+
<div class="col-span-6">
|
|
2574
|
+
<label for="price" class="block font-bold mb-3">Price</label>
|
|
2575
|
+
<p-inputnumber id="price" [(ngModel)]="product.price" mode="currency" currency="USD" locale="en-US" fluid />
|
|
2576
|
+
</div>
|
|
2577
|
+
<div class="col-span-6">
|
|
2578
|
+
<label for="quantity" class="block font-bold mb-3">Quantity</label>
|
|
2579
|
+
<p-inputnumber id="quantity" [(ngModel)]="product.quantity" fluid />
|
|
2580
|
+
</div>
|
|
2581
|
+
</div>
|
|
2582
|
+
</div>
|
|
2583
|
+
</ng-template>
|
|
2584
|
+
<ng-template #footer>
|
|
2585
|
+
<p-button label="Cancel" icon="pi pi-times" text (click)="hideDialog()" />
|
|
2586
|
+
<p-button label="Save" icon="pi pi-check" (click)="saveProduct()" />
|
|
2587
|
+
</ng-template>
|
|
2588
|
+
</p-dialog>
|
|
2589
|
+
<p-confirmdialog [style]="{ width: '450px' }" />
|
|
2590
|
+
</div>
|
|
2591
|
+
`,
|
|
2592
|
+
standalone: true,
|
|
2593
|
+
imports: [ButtonModule, ConfirmDialogModule, DialogModule, SelectModule, FileUploadModule, IconFieldModule, InputIconModule, InputNumberModule, RadioButtonModule, RatingModule, TableModule, TagModule, ToastModule, ToolbarModule, InputTextModule, FormsModule],
|
|
2594
|
+
providers: [ProductService, MessageService, ConfirmationService]
|
|
2595
|
+
})
|
|
2596
|
+
export class TableProductsDemo implements OnInit {
|
|
2597
|
+
private productService = inject(ProductService);
|
|
2598
|
+
private messageService = inject(MessageService);
|
|
2599
|
+
private confirmationService = inject(ConfirmationService);
|
|
2600
|
+
productDialog: boolean = false;
|
|
2601
|
+
products!: Product[];
|
|
2602
|
+
product!: Product;
|
|
2603
|
+
selectedProducts!: Product[] | null;
|
|
2604
|
+
submitted: boolean = false;
|
|
2605
|
+
statuses!: any[];
|
|
2606
|
+
cols!: Column[];
|
|
2607
|
+
exportColumns!: ExportColumn[];
|
|
2608
|
+
|
|
2609
|
+
ngOnInit() {
|
|
2610
|
+
this.productService.getProducts().then((data) => {
|
|
2611
|
+
this.products = data;
|
|
2612
|
+
});
|
|
2613
|
+
this.statuses = [
|
|
2614
|
+
{ label: 'INSTOCK', value: 'instock' },
|
|
2615
|
+
{ label: 'LOWSTOCK', value: 'lowstock' },
|
|
2616
|
+
{ label: 'OUTOFSTOCK', value: 'outofstock' }
|
|
2617
|
+
];
|
|
2618
|
+
this.cols = [
|
|
2619
|
+
{ field: 'code', header: 'Code', customExportHeader: 'Product Code' },
|
|
2620
|
+
{ field: 'name', header: 'Name' },
|
|
2621
|
+
{ field: 'image', header: 'Image' },
|
|
2622
|
+
{ field: 'price', header: 'Price' },
|
|
2623
|
+
{ field: 'category', header: 'Category' }
|
|
2624
|
+
];
|
|
2625
|
+
this.exportColumns = this.cols.map((col) => ({ title: col.header, dataKey: col.field }));
|
|
2626
|
+
}
|
|
2627
|
+
|
|
2628
|
+
openNew() {
|
|
2629
|
+
this.product = {};
|
|
2630
|
+
this.submitted = false;
|
|
2631
|
+
this.productDialog = true;
|
|
2632
|
+
}
|
|
2633
|
+
|
|
2634
|
+
editProduct(product: Product) {
|
|
2635
|
+
this.product = { ...product };
|
|
2636
|
+
this.productDialog = true;
|
|
2637
|
+
}
|
|
2638
|
+
|
|
2639
|
+
deleteSelectedProducts() {
|
|
2640
|
+
this.confirmationService.confirm({
|
|
2641
|
+
message: 'Are you sure you want to delete the selected products?',
|
|
2642
|
+
header: 'Confirm',
|
|
2643
|
+
icon: 'pi pi-exclamation-triangle',
|
|
2644
|
+
rejectButtonProps: {
|
|
2645
|
+
label: 'No',
|
|
2646
|
+
severity: 'secondary',
|
|
2647
|
+
variant: 'text'
|
|
2648
|
+
},
|
|
2649
|
+
acceptButtonProps: {
|
|
2650
|
+
severity: 'danger',
|
|
2651
|
+
label: 'Yes'
|
|
2652
|
+
},
|
|
2653
|
+
accept: () => {
|
|
2654
|
+
this.products = this.products.filter((val) => !this.selectedProducts?.includes(val));
|
|
2655
|
+
this.selectedProducts = null;
|
|
2656
|
+
this.messageService.add({
|
|
2657
|
+
severity: 'success',
|
|
2658
|
+
summary: 'Successful',
|
|
2659
|
+
detail: 'Products Deleted',
|
|
2660
|
+
life: 3000
|
|
2661
|
+
});
|
|
2662
|
+
}
|
|
2663
|
+
});
|
|
2664
|
+
}
|
|
2665
|
+
|
|
2666
|
+
hideDialog() {
|
|
2667
|
+
this.productDialog = false;
|
|
2668
|
+
this.submitted = false;
|
|
2669
|
+
}
|
|
2670
|
+
|
|
2671
|
+
deleteProduct(product: Product) {
|
|
2672
|
+
this.confirmationService.confirm({
|
|
2673
|
+
message: 'Are you sure you want to delete ' + product.name + '?',
|
|
2674
|
+
header: 'Confirm',
|
|
2675
|
+
icon: 'pi pi-exclamation-triangle',
|
|
2676
|
+
rejectButtonProps: {
|
|
2677
|
+
label: 'No',
|
|
2678
|
+
severity: 'secondary',
|
|
2679
|
+
variant: 'text'
|
|
2680
|
+
},
|
|
2681
|
+
acceptButtonProps: {
|
|
2682
|
+
severity: 'danger',
|
|
2683
|
+
label: 'Yes'
|
|
2684
|
+
},
|
|
2685
|
+
accept: () => {
|
|
2686
|
+
this.products = this.products.filter((val) => val.id !== product.id);
|
|
2687
|
+
this.product = {};
|
|
2688
|
+
this.messageService.add({
|
|
2689
|
+
severity: 'success',
|
|
2690
|
+
summary: 'Successful',
|
|
2691
|
+
detail: 'Product Deleted',
|
|
2692
|
+
life: 3000
|
|
2693
|
+
});
|
|
2694
|
+
}
|
|
2695
|
+
});
|
|
2696
|
+
}
|
|
2697
|
+
|
|
2698
|
+
findIndexById(id: string): number {
|
|
2699
|
+
let index = -1;
|
|
2700
|
+
for (let i = 0; i < this.products.length; i++) {
|
|
2701
|
+
if (this.products[i].id === id) {
|
|
2702
|
+
index = i;
|
|
2703
|
+
break;
|
|
2704
|
+
}
|
|
2705
|
+
}
|
|
2706
|
+
|
|
2707
|
+
return index;
|
|
2708
|
+
}
|
|
2709
|
+
|
|
2710
|
+
createId(): string {
|
|
2711
|
+
let id = '';
|
|
2712
|
+
var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
|
2713
|
+
for (var i = 0; i < 5; i++) {
|
|
2714
|
+
id += chars.charAt(Math.floor(Math.random() * chars.length));
|
|
2715
|
+
}
|
|
2716
|
+
return id;
|
|
2717
|
+
}
|
|
2718
|
+
|
|
2719
|
+
getSeverity(status: string) {
|
|
2720
|
+
switch (status) {
|
|
2721
|
+
case 'INSTOCK':
|
|
2722
|
+
return 'success';
|
|
2723
|
+
case 'LOWSTOCK':
|
|
2724
|
+
return 'warn';
|
|
2725
|
+
case 'OUTOFSTOCK':
|
|
2726
|
+
return 'danger';
|
|
2727
|
+
}
|
|
2728
|
+
}
|
|
2729
|
+
|
|
2730
|
+
saveProduct() {
|
|
2731
|
+
this.submitted = true;
|
|
2732
|
+
|
|
2733
|
+
if (this.product.name?.trim()) {
|
|
2734
|
+
if (this.product.id) {
|
|
2735
|
+
this.products[this.findIndexById(this.product.id)] = this.product;
|
|
2736
|
+
this.messageService.add({
|
|
2737
|
+
severity: 'success',
|
|
2738
|
+
summary: 'Successful',
|
|
2739
|
+
detail: 'Product Updated',
|
|
2740
|
+
life: 3000
|
|
2741
|
+
});
|
|
2742
|
+
} else {
|
|
2743
|
+
this.product.id = this.createId();
|
|
2744
|
+
this.product.code = this.createId();
|
|
2745
|
+
this.product.image = 'product-placeholder.svg';
|
|
2746
|
+
this.products.push(this.product);
|
|
2747
|
+
this.messageService.add({
|
|
2748
|
+
severity: 'success',
|
|
2749
|
+
summary: 'Successful',
|
|
2750
|
+
detail: 'Product Created',
|
|
2751
|
+
life: 3000
|
|
2752
|
+
});
|
|
2753
|
+
}
|
|
2754
|
+
|
|
2755
|
+
this.products = [...this.products];
|
|
2756
|
+
this.productDialog = false;
|
|
2757
|
+
this.product = {};
|
|
2758
|
+
}
|
|
2759
|
+
}
|
|
2760
|
+
}
|
|
2761
|
+
```
|
|
2762
|
+
|
|
2763
|
+
## radiobuttonselection-doc
|
|
2764
|
+
|
|
2765
|
+
Single selection can also be handled using radio buttons.
|
|
2766
|
+
|
|
2767
|
+
```typescript
|
|
2768
|
+
import { Component, OnInit, inject } from '@angular/core';
|
|
2769
|
+
import { TableModule } from '@exhaustive-ui/core/table';
|
|
2770
|
+
import { ProductService } from '@/service/productservice';
|
|
2771
|
+
import { Product } from '@/domain/product';
|
|
2772
|
+
|
|
2773
|
+
@Component({
|
|
2774
|
+
template: `
|
|
2775
|
+
<div class="card">
|
|
2776
|
+
<p-table [value]="products" [(selection)]="selectedProduct" dataKey="code" [tableStyle]="{ 'min-width': '50rem' }">
|
|
2777
|
+
<ng-template #header>
|
|
2778
|
+
<tr>
|
|
2779
|
+
<th style="width: 4rem"></th>
|
|
2780
|
+
<th>Code</th>
|
|
2781
|
+
<th>Name</th>
|
|
2782
|
+
<th>Category</th>
|
|
2783
|
+
<th>Quantity</th>
|
|
2784
|
+
</tr>
|
|
2785
|
+
</ng-template>
|
|
2786
|
+
<ng-template #body let-product>
|
|
2787
|
+
<tr>
|
|
2788
|
+
<td>
|
|
2789
|
+
<p-tableRadioButton [value]="product" />
|
|
2790
|
+
</td>
|
|
2791
|
+
<td>{{ product.code }}</td>
|
|
2792
|
+
<td>{{ product.name }}</td>
|
|
2793
|
+
<td>{{ product.category }}</td>
|
|
2794
|
+
<td>{{ product.quantity }}</td>
|
|
2795
|
+
</tr>
|
|
2796
|
+
</ng-template>
|
|
2797
|
+
</p-table>
|
|
2798
|
+
</div>
|
|
2799
|
+
`,
|
|
2800
|
+
standalone: true,
|
|
2801
|
+
imports: [TableModule],
|
|
2802
|
+
providers: [ProductService]
|
|
2803
|
+
})
|
|
2804
|
+
export class TableRadiobuttonselectionDemo implements OnInit {
|
|
2805
|
+
private productService = inject(ProductService);
|
|
2806
|
+
products!: Product[];
|
|
2807
|
+
selectedProduct!: Product;
|
|
2808
|
+
|
|
2809
|
+
ngOnInit() {
|
|
2810
|
+
this.productService.getProductsMini().then((data) => {
|
|
2811
|
+
this.products = data;
|
|
2812
|
+
});
|
|
2813
|
+
}
|
|
2814
|
+
}
|
|
2815
|
+
```
|
|
2816
|
+
|
|
2817
|
+
## removablesort-doc
|
|
2818
|
+
|
|
2819
|
+
The removable sort can be implemented using the customSort property.
|
|
2820
|
+
|
|
2821
|
+
```typescript
|
|
2822
|
+
import { Component, OnInit, inject } from '@angular/core';
|
|
2823
|
+
import { Table, TableModule } from '@exhaustive-ui/core/table';
|
|
2824
|
+
import { ProductService } from '@/service/productservice';
|
|
2825
|
+
import { SortEvent } from '@exhaustive-ui/core/api';
|
|
2826
|
+
import { Product } from '@/domain/product';
|
|
2827
|
+
|
|
2828
|
+
@Component({
|
|
2829
|
+
template: `
|
|
2830
|
+
<div class="card">
|
|
2831
|
+
<p-table #dt [value]="products" (sortFunction)="customSort($event)" [customSort]="true">
|
|
2832
|
+
<ng-template #header>
|
|
2833
|
+
<tr>
|
|
2834
|
+
<th pSortableColumn="code">
|
|
2835
|
+
<div class="flex items-center gap-2">
|
|
2836
|
+
Code
|
|
2837
|
+
<p-sortIcon field="code" />
|
|
2838
|
+
</div>
|
|
2839
|
+
</th>
|
|
2840
|
+
<th pSortableColumn="name">
|
|
2841
|
+
<div class="flex items-center gap-2">
|
|
2842
|
+
Name
|
|
2843
|
+
<p-sortIcon field="name" />
|
|
2844
|
+
</div>
|
|
2845
|
+
</th>
|
|
2846
|
+
<th pSortableColumn="category">
|
|
2847
|
+
<div class="flex items-center gap-2">
|
|
2848
|
+
Category
|
|
2849
|
+
<p-sortIcon field="category" />
|
|
2850
|
+
</div>
|
|
2851
|
+
</th>
|
|
2852
|
+
<th pSortableColumn="quantity">
|
|
2853
|
+
<div class="flex items-center gap-2">
|
|
2854
|
+
Quantity
|
|
2855
|
+
<p-sortIcon field="quantity" />
|
|
2856
|
+
</div>
|
|
2857
|
+
</th>
|
|
2858
|
+
</tr>
|
|
2859
|
+
</ng-template>
|
|
2860
|
+
<ng-template #body let-product>
|
|
2861
|
+
<tr>
|
|
2862
|
+
<td>{{ product.code }}</td>
|
|
2863
|
+
<td>{{ product.name }}</td>
|
|
2864
|
+
<td>{{ product.category }}</td>
|
|
2865
|
+
<td>{{ product.quantity }}</td>
|
|
2866
|
+
</tr>
|
|
2867
|
+
</ng-template>
|
|
2868
|
+
</p-table>
|
|
2869
|
+
</div>
|
|
2870
|
+
`,
|
|
2871
|
+
standalone: true,
|
|
2872
|
+
imports: [TableModule],
|
|
2873
|
+
providers: [ProductService]
|
|
2874
|
+
})
|
|
2875
|
+
export class TableRemovablesortDemo implements OnInit {
|
|
2876
|
+
private productService = inject(ProductService);
|
|
2877
|
+
products: Product[];
|
|
2878
|
+
initialValue: Product[];
|
|
2879
|
+
isSorted: boolean = null;
|
|
2880
|
+
|
|
2881
|
+
ngOnInit() {
|
|
2882
|
+
this.productService.getProductsMini().then((data) => {
|
|
2883
|
+
this.products = data;
|
|
2884
|
+
this.initialValue = [...data];
|
|
2885
|
+
});
|
|
2886
|
+
}
|
|
2887
|
+
|
|
2888
|
+
customSort(event: SortEvent) {
|
|
2889
|
+
if (this.isSorted == null || this.isSorted === undefined) {
|
|
2890
|
+
this.isSorted = true;
|
|
2891
|
+
this.sortTableData(event);
|
|
2892
|
+
} else if (this.isSorted == true) {
|
|
2893
|
+
this.isSorted = false;
|
|
2894
|
+
this.sortTableData(event);
|
|
2895
|
+
} else if (this.isSorted == false) {
|
|
2896
|
+
this.isSorted = null;
|
|
2897
|
+
this.products = [...this.initialValue];
|
|
2898
|
+
this.dt.reset();
|
|
2899
|
+
}
|
|
2900
|
+
}
|
|
2901
|
+
|
|
2902
|
+
sortTableData(event) {
|
|
2903
|
+
event.data.sort((data1, data2) => {
|
|
2904
|
+
let value1 = data1[event.field];
|
|
2905
|
+
let value2 = data2[event.field];
|
|
2906
|
+
let result = null;
|
|
2907
|
+
if (value1 == null && value2 != null) result = -1;
|
|
2908
|
+
else if (value1 != null && value2 == null) result = 1;
|
|
2909
|
+
else if (value1 == null && value2 == null) result = 0;
|
|
2910
|
+
else if (typeof value1 === 'string' && typeof value2 === 'string') result = value1.localeCompare(value2);
|
|
2911
|
+
else result = value1 < value2 ? -1 : value1 > value2 ? 1 : 0;
|
|
2912
|
+
|
|
2913
|
+
return event.order * result;
|
|
2914
|
+
});
|
|
2915
|
+
}
|
|
2916
|
+
}
|
|
2917
|
+
```
|
|
2918
|
+
|
|
2919
|
+
## Reorder
|
|
2920
|
+
|
|
2921
|
+
Order of the columns and rows can be changed using drag and drop. Column reordering is configured by adding reorderableColumns property. Similarly, adding reorderableRows property enables draggable rows. For the drag handle a column needs to have rowReorder property and onRowReorder callback is required to control the state of the rows after reorder completes.
|
|
2922
|
+
|
|
2923
|
+
```typescript
|
|
2924
|
+
import { Component, OnInit, inject } from '@angular/core';
|
|
2925
|
+
import { TableModule } from '@exhaustive-ui/core/table';
|
|
2926
|
+
import { ProductService } from '@/service/productservice';
|
|
2927
|
+
import { Product } from '@/domain/product';
|
|
2928
|
+
|
|
2929
|
+
interface Column {
|
|
2930
|
+
field: string;
|
|
2931
|
+
header: string;
|
|
2932
|
+
}
|
|
2933
|
+
|
|
2934
|
+
@Component({
|
|
2935
|
+
template: `
|
|
2936
|
+
<div class="card">
|
|
2937
|
+
<p-table [value]="products" [columns]="cols" [reorderableColumns]="true" [tableStyle]="{ 'min-width': '50rem' }">
|
|
2938
|
+
<ng-template #header let-columns>
|
|
2939
|
+
<tr>
|
|
2940
|
+
<th style="width:3rem"></th>
|
|
2941
|
+
<th *ngFor="let col of columns" pReorderableColumn>
|
|
2942
|
+
{{ col.header }}
|
|
2943
|
+
</th>
|
|
2944
|
+
</tr>
|
|
2945
|
+
</ng-template>
|
|
2946
|
+
<ng-template #body let-rowData let-columns="columns" let-index="rowIndex">
|
|
2947
|
+
<tr [pReorderableRow]="index">
|
|
2948
|
+
<td>
|
|
2949
|
+
<span class="pi pi-bars" pReorderableRowHandle></span>
|
|
2950
|
+
</td>
|
|
2951
|
+
<td *ngFor="let col of columns">
|
|
2952
|
+
{{ rowData[col.field] }}
|
|
2953
|
+
</td>
|
|
2954
|
+
</tr>
|
|
2955
|
+
</ng-template>
|
|
2956
|
+
</p-table>
|
|
2957
|
+
</div>
|
|
2958
|
+
`,
|
|
2959
|
+
standalone: true,
|
|
2960
|
+
imports: [TableModule],
|
|
2961
|
+
providers: [ProductService]
|
|
2962
|
+
})
|
|
2963
|
+
export class TableReorderDemo implements OnInit {
|
|
2964
|
+
private productService = inject(ProductService);
|
|
2965
|
+
products!: Product[];
|
|
2966
|
+
cols!: Column[];
|
|
2967
|
+
|
|
2968
|
+
ngOnInit() {
|
|
2969
|
+
this.productService.getProductsMini().then((data) => {
|
|
2970
|
+
this.products = data;
|
|
2971
|
+
});
|
|
2972
|
+
this.cols = [
|
|
2973
|
+
{ field: 'code', header: 'Code' },
|
|
2974
|
+
{ field: 'name', header: 'Name' },
|
|
2975
|
+
{ field: 'category', header: 'Category' },
|
|
2976
|
+
{ field: 'quantity', header: 'Quantity' }
|
|
2977
|
+
];
|
|
2978
|
+
}
|
|
2979
|
+
}
|
|
2980
|
+
```
|
|
2981
|
+
|
|
2982
|
+
## rowedit-doc
|
|
2983
|
+
|
|
2984
|
+
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
|
+
|
|
2986
|
+
```typescript
|
|
2987
|
+
import { Component, OnInit, inject } from '@angular/core';
|
|
2988
|
+
import { FormsModule } from '@angular/forms';
|
|
2989
|
+
import { SelectModule } from '@exhaustive-ui/core/select';
|
|
2990
|
+
import { TableModule } from '@exhaustive-ui/core/table';
|
|
2991
|
+
import { TagModule } from '@exhaustive-ui/core/tag';
|
|
2992
|
+
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
|
+
import { Product } from '@/domain/product';
|
|
2999
|
+
|
|
3000
|
+
@Component({
|
|
3001
|
+
template: `
|
|
3002
|
+
<div class="card">
|
|
3003
|
+
<p-toast />
|
|
3004
|
+
<p-table [value]="products" dataKey="id" editMode="row" [tableStyle]="{ 'min-width': '50rem' }">
|
|
3005
|
+
<ng-template #header>
|
|
3006
|
+
<tr>
|
|
3007
|
+
<th style="width:22%">Code</th>
|
|
3008
|
+
<th style="width:22%">Name</th>
|
|
3009
|
+
<th style="width:22%">Inventory Status</th>
|
|
3010
|
+
<th style="width:22%">Price</th>
|
|
3011
|
+
<th style="width:12%"></th>
|
|
3012
|
+
</tr>
|
|
3013
|
+
</ng-template>
|
|
3014
|
+
<ng-template #body let-product let-editing="editing" let-ri="rowIndex">
|
|
3015
|
+
<tr [pEditableRow]="product">
|
|
3016
|
+
<td>
|
|
3017
|
+
<p-cellEditor>
|
|
3018
|
+
<ng-template #input>
|
|
3019
|
+
<input pInputText type="text" [(ngModel)]="product.code" />
|
|
3020
|
+
</ng-template>
|
|
3021
|
+
<ng-template #output>
|
|
3022
|
+
{{ product.code }}
|
|
3023
|
+
</ng-template>
|
|
3024
|
+
</p-cellEditor>
|
|
3025
|
+
</td>
|
|
3026
|
+
<td>
|
|
3027
|
+
<p-cellEditor>
|
|
3028
|
+
<ng-template #input>
|
|
3029
|
+
<input pInputText type="text" [(ngModel)]="product.name" required />
|
|
3030
|
+
</ng-template>
|
|
3031
|
+
<ng-template #output>
|
|
3032
|
+
{{ product.name }}
|
|
3033
|
+
</ng-template>
|
|
3034
|
+
</p-cellEditor>
|
|
3035
|
+
</td>
|
|
3036
|
+
<td>
|
|
3037
|
+
<p-cellEditor>
|
|
3038
|
+
<ng-template #input>
|
|
3039
|
+
<p-select [options]="statuses" appendTo="body" [(ngModel)]="product.inventoryStatus" [style]="{ width: '100%' }" />
|
|
3040
|
+
</ng-template>
|
|
3041
|
+
<ng-template #output>
|
|
3042
|
+
<p-tag [value]="product.inventoryStatus" [severity]="getSeverity(product.inventoryStatus)" />
|
|
3043
|
+
</ng-template>
|
|
3044
|
+
</p-cellEditor>
|
|
3045
|
+
</td>
|
|
3046
|
+
<td>
|
|
3047
|
+
<p-cellEditor>
|
|
3048
|
+
<ng-template #input>
|
|
3049
|
+
<input pInputText type="text" [(ngModel)]="product.price" />
|
|
3050
|
+
</ng-template>
|
|
3051
|
+
<ng-template #output>
|
|
3052
|
+
{{ product.price | currency: 'USD' }}
|
|
3053
|
+
</ng-template>
|
|
3054
|
+
</p-cellEditor>
|
|
3055
|
+
</td>
|
|
3056
|
+
<td>
|
|
3057
|
+
<div class="flex items-center justify-center gap-2">
|
|
3058
|
+
<button *ngIf="!editing" pButton pRipple type="button" pInitEditableRow icon="pi pi-pencil" (click)="onRowEditInit(product)" text rounded severity="secondary"></button>
|
|
3059
|
+
<button *ngIf="editing" pButton pRipple type="button" pSaveEditableRow icon="pi pi-check" (click)="onRowEditSave(product)" text rounded severity="secondary"></button>
|
|
3060
|
+
<button *ngIf="editing" pButton pRipple type="button" pCancelEditableRow icon="pi pi-times" (click)="onRowEditCancel(product, ri)" text rounded severity="secondary"></button>
|
|
3061
|
+
</div>
|
|
3062
|
+
</td>
|
|
3063
|
+
</tr>
|
|
3064
|
+
</ng-template>
|
|
3065
|
+
</p-table>
|
|
3066
|
+
</div>
|
|
3067
|
+
`,
|
|
3068
|
+
standalone: true,
|
|
3069
|
+
imports: [SelectModule, TableModule, TagModule, ToastModule, ButtonModule, InputTextModule, RippleModule, FormsModule],
|
|
3070
|
+
providers: [ProductService, MessageService]
|
|
3071
|
+
})
|
|
3072
|
+
export class TableRoweditDemo implements OnInit {
|
|
3073
|
+
private productService = inject(ProductService);
|
|
3074
|
+
private messageService = inject(MessageService);
|
|
3075
|
+
products!: Product[];
|
|
3076
|
+
statuses!: SelectItem[];
|
|
3077
|
+
|
|
3078
|
+
ngOnInit() {
|
|
3079
|
+
this.productService.getProductsMini().then((data) => {
|
|
3080
|
+
this.products = data;
|
|
3081
|
+
});
|
|
3082
|
+
this.statuses = [
|
|
3083
|
+
{ label: 'In Stock', value: 'INSTOCK' },
|
|
3084
|
+
{ label: 'Low Stock', value: 'LOWSTOCK' },
|
|
3085
|
+
{ label: 'Out of Stock', value: 'OUTOFSTOCK' }
|
|
3086
|
+
];
|
|
3087
|
+
}
|
|
3088
|
+
|
|
3089
|
+
onRowEditInit(product: Product) {
|
|
3090
|
+
this.clonedProducts[product.id as string] = { ...product };
|
|
3091
|
+
}
|
|
3092
|
+
|
|
3093
|
+
onRowEditSave(product: Product) {
|
|
3094
|
+
if (product.price > 0) {
|
|
3095
|
+
delete this.clonedProducts[product.id as string];
|
|
3096
|
+
this.messageService.add({ severity: 'success', summary: 'Success', detail: 'Product is updated' });
|
|
3097
|
+
} else {
|
|
3098
|
+
this.messageService.add({ severity: 'error', summary: 'Error', detail: 'Invalid Price' });
|
|
3099
|
+
}
|
|
3100
|
+
}
|
|
3101
|
+
|
|
3102
|
+
onRowEditCancel(product: Product, index: number) {
|
|
3103
|
+
this.products[index] = this.clonedProducts[product.id as string];
|
|
3104
|
+
delete this.clonedProducts[product.id as string];
|
|
3105
|
+
}
|
|
3106
|
+
|
|
3107
|
+
getSeverity(status: string) {
|
|
3108
|
+
switch (status) {
|
|
3109
|
+
case 'INSTOCK':
|
|
3110
|
+
return 'success';
|
|
3111
|
+
case 'LOWSTOCK':
|
|
3112
|
+
return 'warn';
|
|
3113
|
+
case 'OUTOFSTOCK':
|
|
3114
|
+
return 'danger';
|
|
3115
|
+
}
|
|
3116
|
+
}
|
|
3117
|
+
}
|
|
3118
|
+
```
|
|
3119
|
+
|
|
3120
|
+
## rowexpansion-doc
|
|
3121
|
+
|
|
3122
|
+
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
|
+
|
|
3124
|
+
```typescript
|
|
3125
|
+
import { Component, OnInit, inject } from '@angular/core';
|
|
3126
|
+
import { FormsModule } from '@angular/forms';
|
|
3127
|
+
import { ButtonModule } from '@exhaustive-ui/core/button';
|
|
3128
|
+
import { RatingModule } from '@exhaustive-ui/core/rating';
|
|
3129
|
+
import { TableModule } from '@exhaustive-ui/core/table';
|
|
3130
|
+
import { TagModule } from '@exhaustive-ui/core/tag';
|
|
3131
|
+
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
|
+
import { Product } from '@/domain/product';
|
|
3136
|
+
import { Customer } from '@/domain/customer';
|
|
3137
|
+
|
|
3138
|
+
@Component({
|
|
3139
|
+
template: `
|
|
3140
|
+
<div class="card">
|
|
3141
|
+
<p-toast />
|
|
3142
|
+
<p-table [value]="products" dataKey="id" [tableStyle]="{ 'min-width': '60rem' }" [expandedRowKeys]="expandedRows" (onRowExpand)="onRowExpand($event)" (onRowCollapse)="onRowCollapse($event)">
|
|
3143
|
+
<ng-template #caption>
|
|
3144
|
+
<div class="flex flex-wrap justify-end gap-2">
|
|
3145
|
+
<p-button label="Expand All" icon="pi pi-plus" text (onClick)="expandAll()" />
|
|
3146
|
+
<p-button label="Collapse All" icon="pi pi-minus" text (onClick)="collapseAll()" />
|
|
3147
|
+
</div>
|
|
3148
|
+
</ng-template>
|
|
3149
|
+
<ng-template #header>
|
|
3150
|
+
<tr>
|
|
3151
|
+
<th style="width: 5rem"></th>
|
|
3152
|
+
<th>Name</th>
|
|
3153
|
+
<th>Image</th>
|
|
3154
|
+
<th>Price</th>
|
|
3155
|
+
<th>Category</th>
|
|
3156
|
+
<th>Reviews</th>
|
|
3157
|
+
<th>Status</th>
|
|
3158
|
+
</tr>
|
|
3159
|
+
</ng-template>
|
|
3160
|
+
<ng-template #body let-product let-expanded="expanded">
|
|
3161
|
+
<tr>
|
|
3162
|
+
<td>
|
|
3163
|
+
<p-button type="button" pRipple [pRowToggler]="product" [text]="true" severity="secondary" [rounded]="true" [icon]="expanded ? 'pi pi-chevron-down' : 'pi pi-chevron-right'" />
|
|
3164
|
+
</td>
|
|
3165
|
+
<td>{{ product.name }}</td>
|
|
3166
|
+
<td>
|
|
3167
|
+
<img [src]="'https://exhaustive-ui.e-xiste.com/demo/product/' + product.image" [alt]="product.name" width="50" class="shadow-lg" />
|
|
3168
|
+
</td>
|
|
3169
|
+
<td>{{ product.price | currency: 'USD' }}</td>
|
|
3170
|
+
<td>{{ product.category }}</td>
|
|
3171
|
+
<td>
|
|
3172
|
+
<p-rating [(ngModel)]="product.rating" [readonly]="true" />
|
|
3173
|
+
</td>
|
|
3174
|
+
<td>
|
|
3175
|
+
<p-tag [value]="product.inventoryStatus" [severity]="getSeverity(product.inventoryStatus)" />
|
|
3176
|
+
</td>
|
|
3177
|
+
</tr>
|
|
3178
|
+
</ng-template>
|
|
3179
|
+
<ng-template #expandedrow let-product>
|
|
3180
|
+
<tr>
|
|
3181
|
+
<td colspan="7">
|
|
3182
|
+
<div class="p-4">
|
|
3183
|
+
<h5>Orders for {{ product.name }}</h5>
|
|
3184
|
+
<p-table [value]="product.orders" dataKey="id">
|
|
3185
|
+
<ng-template #header>
|
|
3186
|
+
<tr>
|
|
3187
|
+
<th pSortableColumn="id">
|
|
3188
|
+
<div class="flex items-center gap-2">
|
|
3189
|
+
Id
|
|
3190
|
+
<p-sortIcon field="price" />
|
|
3191
|
+
</div>
|
|
3192
|
+
</th>
|
|
3193
|
+
<th pSortableColumn="customer">
|
|
3194
|
+
<div class="flex items-center gap-2">
|
|
3195
|
+
Customer
|
|
3196
|
+
<p-sortIcon field="customer" />
|
|
3197
|
+
</div>
|
|
3198
|
+
</th>
|
|
3199
|
+
<th pSortableColumn="date">
|
|
3200
|
+
<div class="flex items-center gap-2">
|
|
3201
|
+
Date
|
|
3202
|
+
<p-sortIcon field="date" />
|
|
3203
|
+
</div>
|
|
3204
|
+
</th>
|
|
3205
|
+
<th pSortableColumn="amount">
|
|
3206
|
+
<div class="flex items-center gap-2">
|
|
3207
|
+
Amount
|
|
3208
|
+
<p-sortIcon field="amount" />
|
|
3209
|
+
</div>
|
|
3210
|
+
</th>
|
|
3211
|
+
<th pSortableColumn="status">
|
|
3212
|
+
<div class="flex items-center gap-2">
|
|
3213
|
+
Status
|
|
3214
|
+
<p-sortIcon field="status" />
|
|
3215
|
+
</div>
|
|
3216
|
+
</th>
|
|
3217
|
+
<th style="width: 4rem"></th>
|
|
3218
|
+
</tr>
|
|
3219
|
+
</ng-template>
|
|
3220
|
+
<ng-template #body let-order>
|
|
3221
|
+
<tr>
|
|
3222
|
+
<td>{{ order.id }}</td>
|
|
3223
|
+
<td>{{ order.customer }}</td>
|
|
3224
|
+
<td>{{ order.date }}</td>
|
|
3225
|
+
<td>{{ order.amount | currency: 'USD' }}</td>
|
|
3226
|
+
<td>
|
|
3227
|
+
<p-tag [value]="order.status" [severity]="getStatusSeverity(order.status)" />
|
|
3228
|
+
</td>
|
|
3229
|
+
<td>
|
|
3230
|
+
<p-button type="button" icon="pi pi-search" />
|
|
3231
|
+
</td>
|
|
3232
|
+
</tr>
|
|
3233
|
+
</ng-template>
|
|
3234
|
+
<ng-template #emptymessage>
|
|
3235
|
+
<tr>
|
|
3236
|
+
<td colspan="6">There are no order for this product yet.</td>
|
|
3237
|
+
</tr>
|
|
3238
|
+
</ng-template>
|
|
3239
|
+
</p-table>
|
|
3240
|
+
</div>
|
|
3241
|
+
</td>
|
|
3242
|
+
</tr>
|
|
3243
|
+
</ng-template>
|
|
3244
|
+
</p-table>
|
|
3245
|
+
</div>
|
|
3246
|
+
`,
|
|
3247
|
+
standalone: true,
|
|
3248
|
+
imports: [ButtonModule, RatingModule, TableModule, TagModule, ToastModule, RippleModule, FormsModule],
|
|
3249
|
+
providers: [ProductService, MessageService]
|
|
3250
|
+
})
|
|
3251
|
+
export class TableRowexpansionDemo implements OnInit {
|
|
3252
|
+
private productService = inject(ProductService);
|
|
3253
|
+
private messageService = inject(MessageService);
|
|
3254
|
+
products!: Product[];
|
|
3255
|
+
expandedRows: any = {};
|
|
3256
|
+
|
|
3257
|
+
ngOnInit() {
|
|
3258
|
+
this.productService.getProductsWithOrdersSmall().then((data) => {
|
|
3259
|
+
this.products = data;
|
|
3260
|
+
});
|
|
3261
|
+
}
|
|
3262
|
+
|
|
3263
|
+
expandAll() {
|
|
3264
|
+
this.expandedRows = this.products.reduce((acc, p) => (acc[p.id] = true) && acc, {});
|
|
3265
|
+
}
|
|
3266
|
+
|
|
3267
|
+
collapseAll() {
|
|
3268
|
+
this.expandedRows = {};
|
|
3269
|
+
}
|
|
3270
|
+
|
|
3271
|
+
getSeverity(status: string) {
|
|
3272
|
+
switch (status) {
|
|
3273
|
+
case 'INSTOCK':
|
|
3274
|
+
return 'success';
|
|
3275
|
+
case 'LOWSTOCK':
|
|
3276
|
+
return 'warn';
|
|
3277
|
+
case 'OUTOFSTOCK':
|
|
3278
|
+
return 'danger';
|
|
3279
|
+
}
|
|
3280
|
+
}
|
|
3281
|
+
|
|
3282
|
+
getStatusSeverity(status: string) {
|
|
3283
|
+
switch (status) {
|
|
3284
|
+
case 'PENDING':
|
|
3285
|
+
return 'warn';
|
|
3286
|
+
case 'DELIVERED':
|
|
3287
|
+
return 'success';
|
|
3288
|
+
case 'CANCELLED':
|
|
3289
|
+
return 'danger';
|
|
3290
|
+
}
|
|
3291
|
+
}
|
|
3292
|
+
|
|
3293
|
+
onRowExpand(event: TableRowExpandEvent) {
|
|
3294
|
+
this.messageService.add({ severity: 'info', summary: 'Product Expanded', detail: event.data.name, life: 3000 });
|
|
3295
|
+
}
|
|
3296
|
+
|
|
3297
|
+
onRowCollapse(event: TableRowCollapseEvent) {
|
|
3298
|
+
this.messageService.add({
|
|
3299
|
+
severity: 'success',
|
|
3300
|
+
summary: 'Product Collapsed',
|
|
3301
|
+
detail: event.data.name,
|
|
3302
|
+
life: 3000
|
|
3303
|
+
});
|
|
3304
|
+
}
|
|
3305
|
+
}
|
|
3306
|
+
```
|
|
3307
|
+
|
|
3308
|
+
## rowspangrouping-doc
|
|
3309
|
+
|
|
3310
|
+
When rowGroupMode is configured to be rowspan , the grouping column spans multiple rows.
|
|
3311
|
+
|
|
3312
|
+
```typescript
|
|
3313
|
+
import { Component, OnInit, inject } from '@angular/core';
|
|
3314
|
+
import { TableModule } from '@exhaustive-ui/core/table';
|
|
3315
|
+
import { TagModule } from '@exhaustive-ui/core/tag';
|
|
3316
|
+
import { CustomerService } from '@/service/customerservice';
|
|
3317
|
+
import { Customer, Representative, Country } from '@/domain/customer';
|
|
3318
|
+
|
|
3319
|
+
@Component({
|
|
3320
|
+
template: `
|
|
3321
|
+
<div class="card">
|
|
3322
|
+
<p-table [value]="customers" rowGroupMode="rowspan" groupRowsBy="representative.name" sortField="representative.name" sortMode="single" [tableStyle]="{ 'min-width': '75rem' }">
|
|
3323
|
+
<ng-template #header>
|
|
3324
|
+
<tr>
|
|
3325
|
+
<th style="width:3rem">#</th>
|
|
3326
|
+
<th>Representative</th>
|
|
3327
|
+
<th>Name</th>
|
|
3328
|
+
<th>Country</th>
|
|
3329
|
+
<th>Company</th>
|
|
3330
|
+
<th>Status</th>
|
|
3331
|
+
</tr>
|
|
3332
|
+
</ng-template>
|
|
3333
|
+
<ng-template #body let-customer let-rowIndex="rowIndex" let-rowgroup="rowgroup" let-rowspan="rowspan">
|
|
3334
|
+
<tr>
|
|
3335
|
+
<td>{{ rowIndex }}</td>
|
|
3336
|
+
<td *ngIf="rowgroup" [attr.rowspan]="rowspan">
|
|
3337
|
+
<div class="flex items-center gap-2">
|
|
3338
|
+
<img [alt]="customer.representative.name" src="https://exhaustive-ui.e-xiste.com/demo/avatar/{{ customer.representative.image }}" width="32" />
|
|
3339
|
+
<span>{{ customer.representative.name }}</span>
|
|
3340
|
+
</div>
|
|
3341
|
+
</td>
|
|
3342
|
+
<td>
|
|
3343
|
+
{{ customer.name }}
|
|
3344
|
+
</td>
|
|
3345
|
+
<td>
|
|
3346
|
+
<div class="flex items-center gap-2">
|
|
3347
|
+
<img src="https://exhaustive-ui.e-xiste.com/demo/flag/flag_placeholder.png" [class]="'flag flag-' + customer.country.code" style="width: 20px" />
|
|
3348
|
+
<span>{{ customer.country.name }}</span>
|
|
3349
|
+
</div>
|
|
3350
|
+
</td>
|
|
3351
|
+
<td>
|
|
3352
|
+
{{ customer.company }}
|
|
3353
|
+
</td>
|
|
3354
|
+
<td>
|
|
3355
|
+
<p-tag [value]="customer.status" [severity]="getSeverity(customer.status)" />
|
|
3356
|
+
</td>
|
|
3357
|
+
</tr>
|
|
3358
|
+
</ng-template>
|
|
3359
|
+
</p-table>
|
|
3360
|
+
</div>
|
|
3361
|
+
`,
|
|
3362
|
+
standalone: true,
|
|
3363
|
+
imports: [TableModule, TagModule],
|
|
3364
|
+
providers: [CustomerService]
|
|
3365
|
+
})
|
|
3366
|
+
export class TableRowspangroupingDemo implements OnInit {
|
|
3367
|
+
private customerService = inject(CustomerService);
|
|
3368
|
+
customers!: Customer[];
|
|
3369
|
+
|
|
3370
|
+
ngOnInit() {
|
|
3371
|
+
this.customerService.getCustomersMedium().then((data) => {
|
|
3372
|
+
this.customers = data;
|
|
3373
|
+
});
|
|
3374
|
+
}
|
|
3375
|
+
|
|
3376
|
+
calculateCustomerTotal(name: string) {
|
|
3377
|
+
let total = 0;
|
|
3378
|
+
|
|
3379
|
+
if (this.customers) {
|
|
3380
|
+
for (let customer of this.customers) {
|
|
3381
|
+
if (customer.representative?.name === name) {
|
|
3382
|
+
total++;
|
|
3383
|
+
}
|
|
3384
|
+
}
|
|
3385
|
+
}
|
|
3386
|
+
|
|
3387
|
+
return total;
|
|
3388
|
+
}
|
|
3389
|
+
|
|
3390
|
+
getSeverity(status: string) {
|
|
3391
|
+
switch (status) {
|
|
3392
|
+
case 'unqualified':
|
|
3393
|
+
return 'danger';
|
|
3394
|
+
|
|
3395
|
+
case 'qualified':
|
|
3396
|
+
return 'success';
|
|
3397
|
+
|
|
3398
|
+
case 'new':
|
|
3399
|
+
return 'info';
|
|
3400
|
+
|
|
3401
|
+
case 'negotiation':
|
|
3402
|
+
return 'warn';
|
|
3403
|
+
|
|
3404
|
+
case 'renewal':
|
|
3405
|
+
return null;
|
|
3406
|
+
}
|
|
3407
|
+
}
|
|
3408
|
+
}
|
|
3409
|
+
```
|
|
3410
|
+
|
|
3411
|
+
## selectionevents-doc
|
|
3412
|
+
|
|
3413
|
+
Table provides onRowSelect and onRowUnselect events to listen selection events.
|
|
3414
|
+
|
|
3415
|
+
```typescript
|
|
3416
|
+
import { Component, OnInit, inject } from '@angular/core';
|
|
3417
|
+
import { TableModule } from '@exhaustive-ui/core/table';
|
|
3418
|
+
import { ToastModule } from '@exhaustive-ui/core/toast';
|
|
3419
|
+
import { ProductService } from '@/service/productservice';
|
|
3420
|
+
import { MessageService } from '@exhaustive-ui/core/api';
|
|
3421
|
+
import { Product } from '@/domain/product';
|
|
3422
|
+
|
|
3423
|
+
@Component({
|
|
3424
|
+
template: `
|
|
3425
|
+
<div class="card">
|
|
3426
|
+
<p-toast />
|
|
3427
|
+
<p-table [value]="products" selectionMode="single" [(selection)]="selectedProduct" dataKey="code" (onRowSelect)="onRowSelect($event)" (onRowUnselect)="onRowUnselect($event)" [tableStyle]="{ 'min-width': '50rem' }">
|
|
3428
|
+
<ng-template #header>
|
|
3429
|
+
<tr>
|
|
3430
|
+
<th>Code</th>
|
|
3431
|
+
<th>Name</th>
|
|
3432
|
+
<th>Category</th>
|
|
3433
|
+
<th>Quantity</th>
|
|
3434
|
+
</tr>
|
|
3435
|
+
</ng-template>
|
|
3436
|
+
<ng-template #body let-product>
|
|
3437
|
+
<tr [pSelectableRow]="product">
|
|
3438
|
+
<td>{{ product.code }}</td>
|
|
3439
|
+
<td>{{ product.name }}</td>
|
|
3440
|
+
<td>{{ product.category }}</td>
|
|
3441
|
+
<td>{{ product.quantity }}</td>
|
|
3442
|
+
</tr>
|
|
3443
|
+
</ng-template>
|
|
3444
|
+
</p-table>
|
|
3445
|
+
</div>
|
|
3446
|
+
`,
|
|
3447
|
+
standalone: true,
|
|
3448
|
+
imports: [TableModule, ToastModule],
|
|
3449
|
+
providers: [ProductService, MessageService]
|
|
3450
|
+
})
|
|
3451
|
+
export class TableSelectioneventsDemo implements OnInit {
|
|
3452
|
+
private productService = inject(ProductService);
|
|
3453
|
+
private messageService = inject(MessageService);
|
|
3454
|
+
products!: Product[];
|
|
3455
|
+
selectedProduct!: Product;
|
|
3456
|
+
|
|
3457
|
+
ngOnInit() {
|
|
3458
|
+
this.productService.getProductsMini().then((data) => {
|
|
3459
|
+
this.products = data;
|
|
3460
|
+
});
|
|
3461
|
+
}
|
|
3462
|
+
|
|
3463
|
+
onRowSelect(event: any) {
|
|
3464
|
+
this.messageService.add({ severity: 'info', summary: 'Product Selected', detail: event.data.name });
|
|
3465
|
+
}
|
|
3466
|
+
|
|
3467
|
+
onRowUnselect(event: any) {
|
|
3468
|
+
this.messageService.add({ severity: 'info', summary: 'Product Unselected', detail: event.data.name });
|
|
3469
|
+
}
|
|
3470
|
+
}
|
|
3471
|
+
```
|
|
3472
|
+
|
|
3473
|
+
## singlecolumnsort-doc
|
|
3474
|
+
|
|
3475
|
+
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-sortIcon 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
|
+
|
|
3477
|
+
```typescript
|
|
3478
|
+
import { Component, OnInit, inject } from '@angular/core';
|
|
3479
|
+
import { TableModule } from '@exhaustive-ui/core/table';
|
|
3480
|
+
import { ProductService } from '@/service/productservice';
|
|
3481
|
+
import { Product } from '@/domain/product';
|
|
3482
|
+
|
|
3483
|
+
@Component({
|
|
3484
|
+
template: `
|
|
3485
|
+
<div class="card">
|
|
3486
|
+
<p-table [value]="products" [tableStyle]="{ 'min-width': '60rem' }">
|
|
3487
|
+
<ng-template #header>
|
|
3488
|
+
<tr>
|
|
3489
|
+
<th pSortableColumn="code" style="width:20%">
|
|
3490
|
+
<div class="flex items-center gap-2">
|
|
3491
|
+
Code
|
|
3492
|
+
<p-sortIcon field="code" />
|
|
3493
|
+
</div>
|
|
3494
|
+
</th>
|
|
3495
|
+
<th pSortableColumn="name" style="width:20%">
|
|
3496
|
+
<div class="flex items-center gap-2">
|
|
3497
|
+
Name
|
|
3498
|
+
<p-sortIcon field="name" />
|
|
3499
|
+
</div>
|
|
3500
|
+
</th>
|
|
3501
|
+
<th pSortableColumn="category" style="width:20%">
|
|
3502
|
+
<div class="flex items-center gap-2">
|
|
3503
|
+
Category
|
|
3504
|
+
<p-sortIcon field="category" />
|
|
3505
|
+
</div>
|
|
3506
|
+
</th>
|
|
3507
|
+
<th pSortableColumn="quantity" style="width:20%">
|
|
3508
|
+
<div class="flex items-center gap-2">
|
|
3509
|
+
Quantity
|
|
3510
|
+
<p-sortIcon field="quantity" />
|
|
3511
|
+
</div>
|
|
3512
|
+
</th>
|
|
3513
|
+
</tr>
|
|
3514
|
+
</ng-template>
|
|
3515
|
+
<ng-template #body let-product>
|
|
3516
|
+
<tr>
|
|
3517
|
+
<td>{{ product.code }}</td>
|
|
3518
|
+
<td>{{ product.name }}</td>
|
|
3519
|
+
<td>{{ product.category }}</td>
|
|
3520
|
+
<td>{{ product.quantity }}</td>
|
|
3521
|
+
</tr>
|
|
3522
|
+
</ng-template>
|
|
3523
|
+
</p-table>
|
|
3524
|
+
</div>
|
|
3525
|
+
`,
|
|
3526
|
+
standalone: true,
|
|
3527
|
+
imports: [TableModule],
|
|
3528
|
+
providers: [ProductService]
|
|
3529
|
+
})
|
|
3530
|
+
export class TableSinglecolumnsortDemo implements OnInit {
|
|
3531
|
+
private productService = inject(ProductService);
|
|
3532
|
+
products!: Product[];
|
|
3533
|
+
|
|
3534
|
+
ngOnInit() {
|
|
3535
|
+
this.productService.getProductsMini().then((data) => {
|
|
3536
|
+
this.products = data;
|
|
3537
|
+
});
|
|
3538
|
+
}
|
|
3539
|
+
}
|
|
3540
|
+
```
|
|
3541
|
+
|
|
3542
|
+
## singleselection-doc
|
|
3543
|
+
|
|
3544
|
+
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
|
+
|
|
3546
|
+
```typescript
|
|
3547
|
+
import { Component, OnInit, inject } from '@angular/core';
|
|
3548
|
+
import { FormsModule } from '@angular/forms';
|
|
3549
|
+
import { TableModule } from '@exhaustive-ui/core/table';
|
|
3550
|
+
import { ToggleSwitchModule } from '@exhaustive-ui/core/toggleswitch';
|
|
3551
|
+
import { ProductService } from '@/service/productservice';
|
|
3552
|
+
import { Product } from '@/domain/product';
|
|
3553
|
+
|
|
3554
|
+
@Component({
|
|
3555
|
+
template: `
|
|
3556
|
+
<div class="card">
|
|
3557
|
+
<div class="flex justify-center items-center mb-6 gap-2">
|
|
3558
|
+
<p-toggleswitch [(ngModel)]="metaKey" inputId="input-metakey" />
|
|
3559
|
+
<label for="input-metakey">MetaKey</label>
|
|
3560
|
+
</div>
|
|
3561
|
+
<p-table [value]="products" selectionMode="single" [(selection)]="selectedProduct" [metaKeySelection]="metaKey" dataKey="id" [tableStyle]="{ 'min-width': '50rem' }">
|
|
3562
|
+
<ng-template #header>
|
|
3563
|
+
<tr>
|
|
3564
|
+
<th>Code</th>
|
|
3565
|
+
<th>Name</th>
|
|
3566
|
+
<th>Category</th>
|
|
3567
|
+
<th>Quantity</th>
|
|
3568
|
+
</tr>
|
|
3569
|
+
</ng-template>
|
|
3570
|
+
<ng-template #body let-product>
|
|
3571
|
+
<tr [pSelectableRow]="product">
|
|
3572
|
+
<td>{{ product.code }}</td>
|
|
3573
|
+
<td>{{ product.name }}</td>
|
|
3574
|
+
<td>{{ product.category }}</td>
|
|
3575
|
+
<td>{{ product.quantity }}</td>
|
|
3576
|
+
</tr>
|
|
3577
|
+
</ng-template>
|
|
3578
|
+
</p-table>
|
|
3579
|
+
</div>
|
|
3580
|
+
`,
|
|
3581
|
+
standalone: true,
|
|
3582
|
+
imports: [TableModule, ToggleSwitchModule, FormsModule],
|
|
3583
|
+
providers: [ProductService]
|
|
3584
|
+
})
|
|
3585
|
+
export class TableSingleselectionDemo implements OnInit {
|
|
3586
|
+
private productService = inject(ProductService);
|
|
3587
|
+
products!: Product[];
|
|
3588
|
+
selectedProduct!: Product;
|
|
3589
|
+
metaKey: boolean = true;
|
|
3590
|
+
|
|
3591
|
+
ngOnInit() {
|
|
3592
|
+
this.productService.getProductsMini().then((data) => {
|
|
3593
|
+
this.products = data;
|
|
3594
|
+
});
|
|
3595
|
+
}
|
|
3596
|
+
}
|
|
3597
|
+
```
|
|
3598
|
+
|
|
3599
|
+
## Size
|
|
3600
|
+
|
|
3601
|
+
In addition to a regular table, alternatives with alternative sizes are available.
|
|
3602
|
+
|
|
3603
|
+
```typescript
|
|
3604
|
+
import { Component, OnInit, inject } from '@angular/core';
|
|
3605
|
+
import { FormsModule } from '@angular/forms';
|
|
3606
|
+
import { SelectButtonModule } from '@exhaustive-ui/core/selectbutton';
|
|
3607
|
+
import { TableModule } from '@exhaustive-ui/core/table';
|
|
3608
|
+
import { ProductService } from '@/service/productservice';
|
|
3609
|
+
import { Product } from '@/domain/product';
|
|
3610
|
+
|
|
3611
|
+
@Component({
|
|
3612
|
+
template: `
|
|
3613
|
+
<div class="card">
|
|
3614
|
+
<div class="flex justify-center mb-4">
|
|
3615
|
+
<p-selectbutton [options]="sizes" [(ngModel)]="selectedSize" [multiple]="false" optionLabel="name" optionValue="value" />
|
|
3616
|
+
</div>
|
|
3617
|
+
<p-table [value]="products" [tableStyle]="{ 'min-width': '50rem' }" [size]="selectedSize">
|
|
3618
|
+
<ng-template #header>
|
|
3619
|
+
<tr>
|
|
3620
|
+
<th>Code</th>
|
|
3621
|
+
<th>Name</th>
|
|
3622
|
+
<th>Category</th>
|
|
3623
|
+
<th>Quantity</th>
|
|
3624
|
+
</tr>
|
|
3625
|
+
</ng-template>
|
|
3626
|
+
<ng-template #body let-product>
|
|
3627
|
+
<tr>
|
|
3628
|
+
<td>{{ product.code }}</td>
|
|
3629
|
+
<td>{{ product.name }}</td>
|
|
3630
|
+
<td>{{ product.category }}</td>
|
|
3631
|
+
<td>{{ product.quantity }}</td>
|
|
3632
|
+
</tr>
|
|
3633
|
+
</ng-template>
|
|
3634
|
+
</p-table>
|
|
3635
|
+
</div>
|
|
3636
|
+
`,
|
|
3637
|
+
standalone: true,
|
|
3638
|
+
imports: [SelectButtonModule, TableModule, FormsModule],
|
|
3639
|
+
providers: [ProductService]
|
|
3640
|
+
})
|
|
3641
|
+
export class TableSizeDemo implements OnInit {
|
|
3642
|
+
private productService = inject(ProductService);
|
|
3643
|
+
products!: Product[];
|
|
3644
|
+
sizes!: any[];
|
|
3645
|
+
selectedSize: any = undefined;
|
|
3646
|
+
|
|
3647
|
+
ngOnInit() {
|
|
3648
|
+
this.productService.getProductsMini().then((data) => {
|
|
3649
|
+
this.products = data;
|
|
3650
|
+
});
|
|
3651
|
+
this.sizes = [
|
|
3652
|
+
{ name: 'Small', value: 'small' },
|
|
3653
|
+
{ name: 'Normal', value: undefined },
|
|
3654
|
+
{ name: 'Large', value: 'large' }
|
|
3655
|
+
];
|
|
3656
|
+
}
|
|
3657
|
+
}
|
|
3658
|
+
```
|
|
3659
|
+
|
|
3660
|
+
## Stateful
|
|
3661
|
+
|
|
3662
|
+
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
|
+
|
|
3664
|
+
```typescript
|
|
3665
|
+
import { Component, OnInit, inject } from '@angular/core';
|
|
3666
|
+
import { IconFieldModule } from '@exhaustive-ui/core/iconfield';
|
|
3667
|
+
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
|
+
import { InputTextModule } from '@exhaustive-ui/core/inputtext';
|
|
3671
|
+
import { CustomerService } from '@/service/customerservice';
|
|
3672
|
+
import { Customer, Representative, Country } from '@/domain/customer';
|
|
3673
|
+
|
|
3674
|
+
@Component({
|
|
3675
|
+
template: `
|
|
3676
|
+
<div class="card">
|
|
3677
|
+
<p-table
|
|
3678
|
+
#dt1
|
|
3679
|
+
[value]="customers"
|
|
3680
|
+
[globalFilterFields]="['name', 'country.name', 'representative.name', 'status']"
|
|
3681
|
+
selectionMode="single"
|
|
3682
|
+
[(selection)]="selectedCustomers"
|
|
3683
|
+
dataKey="id"
|
|
3684
|
+
[tableStyle]="{ 'min-width': '50rem' }"
|
|
3685
|
+
[rows]="5"
|
|
3686
|
+
[paginator]="true"
|
|
3687
|
+
stateStorage="session"
|
|
3688
|
+
stateKey="statedemo-session"
|
|
3689
|
+
>
|
|
3690
|
+
<ng-template #caption>
|
|
3691
|
+
<p-iconfield iconPosition="left">
|
|
3692
|
+
<p-inputicon>
|
|
3693
|
+
<i class="pi pi-search"></i>
|
|
3694
|
+
</p-inputicon>
|
|
3695
|
+
<input pInputText type="text" [value]="dt1._filters()['global']?.value" (input)="dt1.filterGlobal($event.target.value, 'contains')" placeholder="Global Search" />
|
|
3696
|
+
</p-iconfield>
|
|
3697
|
+
</ng-template>
|
|
3698
|
+
<ng-template #header>
|
|
3699
|
+
<tr>
|
|
3700
|
+
<th pSortableColumn="name" style="width:25%">
|
|
3701
|
+
<div class="flex items-center gap-2">
|
|
3702
|
+
Name
|
|
3703
|
+
<p-sortIcon field="name" />
|
|
3704
|
+
</div>
|
|
3705
|
+
</th>
|
|
3706
|
+
<th pSortableColumn="country.name" style="width:25%">
|
|
3707
|
+
<div class="flex items-center gap-2">
|
|
3708
|
+
Country
|
|
3709
|
+
<p-sortIcon field="country.name" />
|
|
3710
|
+
</div>
|
|
3711
|
+
</th>
|
|
3712
|
+
<th pSortableColumn="representative.name" style="width:25%">
|
|
3713
|
+
<div class="flex items-center gap-2">
|
|
3714
|
+
Representative
|
|
3715
|
+
<p-sortIcon field="representative.name" />
|
|
3716
|
+
</div>
|
|
3717
|
+
</th>
|
|
3718
|
+
<th pSortableColumn="status" style="width:25%">
|
|
3719
|
+
<div class="flex items-center gap-2">
|
|
3720
|
+
Status
|
|
3721
|
+
<p-sortIcon field="status" />
|
|
3722
|
+
</div>
|
|
3723
|
+
</th>
|
|
3724
|
+
</tr>
|
|
3725
|
+
</ng-template>
|
|
3726
|
+
<ng-template #body let-customer>
|
|
3727
|
+
<tr [pSelectableRow]="customer">
|
|
3728
|
+
<td>
|
|
3729
|
+
{{ customer.name }}
|
|
3730
|
+
</td>
|
|
3731
|
+
<td>
|
|
3732
|
+
<div class="flex items-center gap-2">
|
|
3733
|
+
<img src="https://exhaustive-ui.e-xiste.com/demo/flag/flag_placeholder.png" [class]="'flag flag-' + customer.country.code" style="width: 20px" />
|
|
3734
|
+
<span class="ml-1 align-middle">{{ customer.country.name }}</span>
|
|
3735
|
+
</div>
|
|
3736
|
+
</td>
|
|
3737
|
+
<td>
|
|
3738
|
+
<div class="flex items-center gap-2">
|
|
3739
|
+
<img [alt]="customer.representative.name" src="https://exhaustive-ui.e-xiste.com/demo/avatar/{{ customer.representative.image }}" width="32" style="vertical-align: middle" />
|
|
3740
|
+
<span class="ml-1 align-middle">{{ customer.representative.name }}</span>
|
|
3741
|
+
</div>
|
|
3742
|
+
</td>
|
|
3743
|
+
<td>
|
|
3744
|
+
<p-tag [value]="customer.status" [severity]="getSeverity(customer.status)" />
|
|
3745
|
+
</td>
|
|
3746
|
+
</tr>
|
|
3747
|
+
</ng-template>
|
|
3748
|
+
<ng-template #body let-customer>
|
|
3749
|
+
<tr [pSelectableRow]="customer">
|
|
3750
|
+
<td>
|
|
3751
|
+
{{ customer.name }}
|
|
3752
|
+
</td>
|
|
3753
|
+
<td>
|
|
3754
|
+
<img src="https://exhaustive-ui.e-xiste.com/demo/flag/flag_placeholder.png" [class]="'flag flag-' + customer.country.code" style="width: 20px" />
|
|
3755
|
+
<span class="ml-1 align-middle">{{ customer.country.name }}</span>
|
|
3756
|
+
</td>
|
|
3757
|
+
<td>
|
|
3758
|
+
<img [alt]="customer.representative.name" src="https://exhaustive-ui.e-xiste.com/demo/avatar/{{ customer.representative.image }}" width="32" style="vertical-align: middle" />
|
|
3759
|
+
<span class="ml-1 align-middle">{{ customer.representative.name }}</span>
|
|
3760
|
+
</td>
|
|
3761
|
+
<td>
|
|
3762
|
+
<p-tag [value]="customer.status" [severity]="getSeverity(customer.status)" />
|
|
3763
|
+
</td>
|
|
3764
|
+
</tr>
|
|
3765
|
+
</ng-template>
|
|
3766
|
+
<ng-template #emptymessage>
|
|
3767
|
+
<tr>
|
|
3768
|
+
<td colspan="4">No customers found.</td>
|
|
3769
|
+
</tr>
|
|
3770
|
+
</ng-template>
|
|
3771
|
+
</p-table>
|
|
3772
|
+
</div>
|
|
3773
|
+
`,
|
|
3774
|
+
standalone: true,
|
|
3775
|
+
imports: [IconFieldModule, InputIconModule, TableModule, TagModule, InputTextModule],
|
|
3776
|
+
providers: [CustomerService]
|
|
3777
|
+
})
|
|
3778
|
+
export class TableStatefulDemo implements OnInit {
|
|
3779
|
+
private customerService = inject(CustomerService);
|
|
3780
|
+
customers!: Customer[];
|
|
3781
|
+
selectedCustomers!: Customer;
|
|
3782
|
+
|
|
3783
|
+
ngOnInit() {
|
|
3784
|
+
this.customerService.getCustomersSmall().then((data) => {
|
|
3785
|
+
this.customers = data;
|
|
3786
|
+
});
|
|
3787
|
+
}
|
|
3788
|
+
}
|
|
3789
|
+
```
|
|
3790
|
+
|
|
3791
|
+
## Striped Rows
|
|
3792
|
+
|
|
3793
|
+
Alternating rows are displayed when stripedRows property is present.
|
|
3794
|
+
|
|
3795
|
+
```typescript
|
|
3796
|
+
import { Component, OnInit, inject } from '@angular/core';
|
|
3797
|
+
import { TableModule } from '@exhaustive-ui/core/table';
|
|
3798
|
+
import { ProductService } from '@/service/productservice';
|
|
3799
|
+
import { Product } from '@/domain/product';
|
|
3800
|
+
|
|
3801
|
+
@Component({
|
|
3802
|
+
template: `
|
|
3803
|
+
<div class="card">
|
|
3804
|
+
<p-table [value]="products" stripedRows [tableStyle]="{ 'min-width': '50rem' }">
|
|
3805
|
+
<ng-template #header>
|
|
3806
|
+
<tr>
|
|
3807
|
+
<th>Code</th>
|
|
3808
|
+
<th>Name</th>
|
|
3809
|
+
<th>Category</th>
|
|
3810
|
+
<th>Quantity</th>
|
|
3811
|
+
</tr>
|
|
3812
|
+
</ng-template>
|
|
3813
|
+
<ng-template #body let-product>
|
|
3814
|
+
<tr>
|
|
3815
|
+
<td>{{ product.code }}</td>
|
|
3816
|
+
<td>{{ product.name }}</td>
|
|
3817
|
+
<td>{{ product.category }}</td>
|
|
3818
|
+
<td>{{ product.quantity }}</td>
|
|
3819
|
+
</tr>
|
|
3820
|
+
</ng-template>
|
|
3821
|
+
</p-table>
|
|
3822
|
+
</div>
|
|
3823
|
+
`,
|
|
3824
|
+
standalone: true,
|
|
3825
|
+
imports: [TableModule],
|
|
3826
|
+
providers: [ProductService]
|
|
3827
|
+
})
|
|
3828
|
+
export class TableStripedDemo implements OnInit {
|
|
3829
|
+
private productService = inject(ProductService);
|
|
3830
|
+
products!: Product[];
|
|
3831
|
+
|
|
3832
|
+
ngOnInit() {
|
|
3833
|
+
this.productService.getProductsMini().then((data) => {
|
|
3834
|
+
this.products = data;
|
|
3835
|
+
});
|
|
3836
|
+
}
|
|
3837
|
+
}
|
|
3838
|
+
```
|
|
3839
|
+
|
|
3840
|
+
## style-doc
|
|
3841
|
+
|
|
3842
|
+
Certain rows or cells can easily be styled based on conditions.
|
|
3843
|
+
|
|
3844
|
+
## styling-doc
|
|
3845
|
+
|
|
3846
|
+
```typescript
|
|
3847
|
+
import { Component } from '@angular/core';
|
|
3848
|
+
|
|
3849
|
+
@Component({
|
|
3850
|
+
template: `
|
|
3851
|
+
<div class="doc-tablewrapper">
|
|
3852
|
+
<table class="doc-table">
|
|
3853
|
+
<thead>
|
|
3854
|
+
<tr>
|
|
3855
|
+
<th>Name</th>
|
|
3856
|
+
<th>Element</th>
|
|
3857
|
+
</tr>
|
|
3858
|
+
</thead>
|
|
3859
|
+
<tbody>
|
|
3860
|
+
<tr>
|
|
3861
|
+
<td>p-datatable</td>
|
|
3862
|
+
<td>Container element.</td>
|
|
3863
|
+
</tr>
|
|
3864
|
+
<tr>
|
|
3865
|
+
<td>p-datatable-header</td>
|
|
3866
|
+
<td>Header section.</td>
|
|
3867
|
+
</tr>
|
|
3868
|
+
<tr>
|
|
3869
|
+
<td>p-datatable-footer</td>
|
|
3870
|
+
<td>Footer section.</td>
|
|
3871
|
+
</tr>
|
|
3872
|
+
<tr>
|
|
3873
|
+
<td>p-sortable-column</td>
|
|
3874
|
+
<td>Sortable column header.</td>
|
|
3875
|
+
</tr>
|
|
3876
|
+
<tr>
|
|
3877
|
+
<td>p-editable-column</td>
|
|
3878
|
+
<td>Editable column cell.</td>
|
|
3879
|
+
</tr>
|
|
3880
|
+
<tr>
|
|
3881
|
+
<td>p-datatable-thead</td>
|
|
3882
|
+
<td>Thead element of header columns.</td>
|
|
3883
|
+
</tr>
|
|
3884
|
+
<tr>
|
|
3885
|
+
<td>p-datatable-tbody</td>
|
|
3886
|
+
<td>Tbody element of body rows.</td>
|
|
3887
|
+
</tr>
|
|
3888
|
+
<tr>
|
|
3889
|
+
<td>p-datatable-tfoot</td>
|
|
3890
|
+
<td>Tfoot element of footer columns.</td>
|
|
3891
|
+
</tr>
|
|
3892
|
+
<tr>
|
|
3893
|
+
<td>p-datatable-scrollable</td>
|
|
3894
|
+
<td>Container element when scrolling is enabled.</td>
|
|
3895
|
+
</tr>
|
|
3896
|
+
<tr>
|
|
3897
|
+
<td>p-datatable-resizable</td>
|
|
3898
|
+
<td>Container element when column resizing is enabled.</td>
|
|
3899
|
+
</tr>
|
|
3900
|
+
<tr>
|
|
3901
|
+
<td>p-datatable-resizable-fit</td>
|
|
3902
|
+
<td>Container element when column resizing is enabled and set to fit mode.</td>
|
|
3903
|
+
</tr>
|
|
3904
|
+
<tr>
|
|
3905
|
+
<td>p-column-resizer-helper</td>
|
|
3906
|
+
<td>Vertical resizer indicator bar.</td>
|
|
3907
|
+
</tr>
|
|
3908
|
+
<tr>
|
|
3909
|
+
<td>p-datatable-reorderablerow-handle</td>
|
|
3910
|
+
<td>Handle element of a reorderable row.</td>
|
|
3911
|
+
</tr>
|
|
3912
|
+
<tr>
|
|
3913
|
+
<td>p-datatable-reorder-indicator-up</td>
|
|
3914
|
+
<td>Up indicator to display during column reordering.</td>
|
|
3915
|
+
</tr>
|
|
3916
|
+
<tr>
|
|
3917
|
+
<td>p-datatable-reorder-indicator-up</td>
|
|
3918
|
+
<td>Down indicator to display during column reordering.</td>
|
|
3919
|
+
</tr>
|
|
3920
|
+
<tr>
|
|
3921
|
+
<td>p-datatable-loading-overlay</td>
|
|
3922
|
+
<td>Overlay to display when table is loading.</td>
|
|
3923
|
+
</tr>
|
|
3924
|
+
<tr>
|
|
3925
|
+
<td>p-datatable-loading-icon</td>
|
|
3926
|
+
<td>Icon to display when table is loading.</td>
|
|
3927
|
+
</tr>
|
|
3928
|
+
</tbody>
|
|
3929
|
+
</table>
|
|
3930
|
+
</div>
|
|
3931
|
+
`,
|
|
3932
|
+
standalone: true,
|
|
3933
|
+
imports: []
|
|
3934
|
+
})
|
|
3935
|
+
export class TableStylingDemo {}
|
|
3936
|
+
```
|
|
3937
|
+
|
|
3938
|
+
## subheadergrouping-doc
|
|
3939
|
+
|
|
3940
|
+
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
|
+
|
|
3942
|
+
```typescript
|
|
3943
|
+
import { Component, OnInit, inject } from '@angular/core';
|
|
3944
|
+
import { TableModule } from '@exhaustive-ui/core/table';
|
|
3945
|
+
import { TagModule } from '@exhaustive-ui/core/tag';
|
|
3946
|
+
import { CustomerService } from '@/service/customerservice';
|
|
3947
|
+
import { Customer, Country } from '@/domain/customer';
|
|
3948
|
+
|
|
3949
|
+
@Component({
|
|
3950
|
+
template: `
|
|
3951
|
+
<div class="card">
|
|
3952
|
+
<p-table [value]="customers" sortField="representative.name" sortMode="single" [scrollable]="true" scrollHeight="400px" rowGroupMode="subheader" groupRowsBy="representative.name" [tableStyle]="{ 'min-width': '60rem' }">
|
|
3953
|
+
<ng-template #header>
|
|
3954
|
+
<tr>
|
|
3955
|
+
<th>Name</th>
|
|
3956
|
+
<th>Country</th>
|
|
3957
|
+
<th>Company</th>
|
|
3958
|
+
<th>Status</th>
|
|
3959
|
+
<th>Date</th>
|
|
3960
|
+
</tr>
|
|
3961
|
+
</ng-template>
|
|
3962
|
+
<ng-template #groupheader let-customer>
|
|
3963
|
+
<tr pRowGroupHeader>
|
|
3964
|
+
<td colspan="5">
|
|
3965
|
+
<div class="flex items-center gap-2">
|
|
3966
|
+
<img [alt]="customer.representative.name" src="https://exhaustive-ui.e-xiste.com/demo/avatar/{{ customer.representative.image }}" width="32" style="vertical-align: middle" />
|
|
3967
|
+
<span class="font-bold">{{ customer.representative.name }}</span>
|
|
3968
|
+
</div>
|
|
3969
|
+
</td>
|
|
3970
|
+
</tr>
|
|
3971
|
+
</ng-template>
|
|
3972
|
+
<ng-template #groupfooter let-customer>
|
|
3973
|
+
<tr>
|
|
3974
|
+
<td colspan="5">
|
|
3975
|
+
<div class="text-right font-bold pe-12">Total Customers: {{ calculateCustomerTotal(customer.representative.name) }}</div>
|
|
3976
|
+
</td>
|
|
3977
|
+
</tr>
|
|
3978
|
+
</ng-template>
|
|
3979
|
+
<ng-template #body let-customer let-rowIndex="rowIndex">
|
|
3980
|
+
<tr>
|
|
3981
|
+
<td>
|
|
3982
|
+
{{ customer.name }}
|
|
3983
|
+
</td>
|
|
3984
|
+
<td>
|
|
3985
|
+
<div class="flex items-center gap-2">
|
|
3986
|
+
<img src="https://exhaustive-ui.e-xiste.com/demo/flag/flag_placeholder.png" [class]="'flag flag-' + customer.country.code" style="width: 20px" />
|
|
3987
|
+
<span>{{ customer.country.name }}</span>
|
|
3988
|
+
</div>
|
|
3989
|
+
</td>
|
|
3990
|
+
<td>
|
|
3991
|
+
{{ customer.company }}
|
|
3992
|
+
</td>
|
|
3993
|
+
<td>
|
|
3994
|
+
<p-tag [value]="customer.status" [severity]="getSeverity(customer.status)" />
|
|
3995
|
+
</td>
|
|
3996
|
+
<td>
|
|
3997
|
+
{{ customer.date }}
|
|
3998
|
+
</td>
|
|
3999
|
+
</tr>
|
|
4000
|
+
</ng-template>
|
|
4001
|
+
</p-table>
|
|
4002
|
+
</div>
|
|
4003
|
+
`,
|
|
4004
|
+
standalone: true,
|
|
4005
|
+
imports: [TableModule, TagModule],
|
|
4006
|
+
providers: [CustomerService]
|
|
4007
|
+
})
|
|
4008
|
+
export class TableSubheadergroupingDemo implements OnInit {
|
|
4009
|
+
private customerService = inject(CustomerService);
|
|
4010
|
+
customers!: Customer[];
|
|
4011
|
+
|
|
4012
|
+
ngOnInit() {
|
|
4013
|
+
this.customerService.getCustomersMedium().then((data) => {
|
|
4014
|
+
this.customers = data;
|
|
4015
|
+
});
|
|
4016
|
+
}
|
|
4017
|
+
|
|
4018
|
+
calculateCustomerTotal(name: string) {
|
|
4019
|
+
let total = 0;
|
|
4020
|
+
|
|
4021
|
+
if (this.customers) {
|
|
4022
|
+
for (let customer of this.customers) {
|
|
4023
|
+
if (customer.representative?.name === name) {
|
|
4024
|
+
total++;
|
|
4025
|
+
}
|
|
4026
|
+
}
|
|
4027
|
+
}
|
|
4028
|
+
|
|
4029
|
+
return total;
|
|
4030
|
+
}
|
|
4031
|
+
|
|
4032
|
+
getSeverity(status: string) {
|
|
4033
|
+
switch (status) {
|
|
4034
|
+
case 'unqualified':
|
|
4035
|
+
return 'danger';
|
|
4036
|
+
|
|
4037
|
+
case 'qualified':
|
|
4038
|
+
return 'success';
|
|
4039
|
+
|
|
4040
|
+
case 'new':
|
|
4041
|
+
return 'info';
|
|
4042
|
+
|
|
4043
|
+
case 'negotiation':
|
|
4044
|
+
return 'warn';
|
|
4045
|
+
|
|
4046
|
+
case 'renewal':
|
|
4047
|
+
return null;
|
|
4048
|
+
}
|
|
4049
|
+
}
|
|
4050
|
+
}
|
|
4051
|
+
```
|
|
4052
|
+
|
|
4053
|
+
## Template
|
|
4054
|
+
|
|
4055
|
+
Custom content at header , body and footer sections are supported via templating.
|
|
4056
|
+
|
|
4057
|
+
```typescript
|
|
4058
|
+
import { Component, OnInit, inject } from '@angular/core';
|
|
4059
|
+
import { FormsModule } from '@angular/forms';
|
|
4060
|
+
import { ButtonModule } from '@exhaustive-ui/core/button';
|
|
4061
|
+
import { RatingModule } from '@exhaustive-ui/core/rating';
|
|
4062
|
+
import { TableModule } from '@exhaustive-ui/core/table';
|
|
4063
|
+
import { TagModule } from '@exhaustive-ui/core/tag';
|
|
4064
|
+
import { ProductService } from '@/service/productservice';
|
|
4065
|
+
import { Product } from '@/domain/product';
|
|
4066
|
+
|
|
4067
|
+
interface Column {
|
|
4068
|
+
field: string;
|
|
4069
|
+
header: string;
|
|
4070
|
+
}
|
|
4071
|
+
|
|
4072
|
+
@Component({
|
|
4073
|
+
template: `
|
|
4074
|
+
<div class="card">
|
|
4075
|
+
<p-table [value]="products" [tableStyle]="{ 'min-width': '60rem' }">
|
|
4076
|
+
<ng-template #caption>
|
|
4077
|
+
<div class="flex items-center justify-between">
|
|
4078
|
+
<span class="text-xl font-bold">Products</span>
|
|
4079
|
+
<p-button icon="pi pi-refresh" rounded raised />
|
|
4080
|
+
</div>
|
|
4081
|
+
</ng-template>
|
|
4082
|
+
<ng-template #header>
|
|
4083
|
+
<tr>
|
|
4084
|
+
<th>Name</th>
|
|
4085
|
+
<th>Image</th>
|
|
4086
|
+
<th>Price</th>
|
|
4087
|
+
<th>Category</th>
|
|
4088
|
+
<th>Reviews</th>
|
|
4089
|
+
<th>Status</th>
|
|
4090
|
+
</tr>
|
|
4091
|
+
</ng-template>
|
|
4092
|
+
<ng-template #body let-product>
|
|
4093
|
+
<tr>
|
|
4094
|
+
<td>{{ product.name }}</td>
|
|
4095
|
+
<td>
|
|
4096
|
+
<img [src]="'https://exhaustive-ui.e-xiste.com/demo/product/' + product.image" [alt]="product.name" class="w-24 rounded" />
|
|
4097
|
+
</td>
|
|
4098
|
+
<td>{{ product.price | currency: 'USD' }}</td>
|
|
4099
|
+
<td>{{ product.category }}</td>
|
|
4100
|
+
<td><p-rating [(ngModel)]="product.rating" [readonly]="true" /></td>
|
|
4101
|
+
<td>
|
|
4102
|
+
<p-tag [value]="product.inventoryStatus" [severity]="getSeverity(product.inventoryStatus)" />
|
|
4103
|
+
</td>
|
|
4104
|
+
</tr>
|
|
4105
|
+
</ng-template>
|
|
4106
|
+
<ng-template #footer>
|
|
4107
|
+
<tr>
|
|
4108
|
+
<td colspan="6">In total there are {{ products ? products.length : 0 }} products.</td>
|
|
4109
|
+
</tr>
|
|
4110
|
+
</ng-template>
|
|
4111
|
+
</p-table>
|
|
4112
|
+
</div>
|
|
4113
|
+
`,
|
|
4114
|
+
standalone: true,
|
|
4115
|
+
imports: [ButtonModule, RatingModule, TableModule, TagModule, FormsModule],
|
|
4116
|
+
providers: [ProductService]
|
|
4117
|
+
})
|
|
4118
|
+
export class TableTemplateDemo implements OnInit {
|
|
4119
|
+
private productService = inject(ProductService);
|
|
4120
|
+
products!: Product[];
|
|
4121
|
+
cols!: Column[];
|
|
4122
|
+
|
|
4123
|
+
ngOnInit() {
|
|
4124
|
+
this.productService.getProductsMini().then((data) => {
|
|
4125
|
+
this.products = data;
|
|
4126
|
+
});
|
|
4127
|
+
this.cols = [
|
|
4128
|
+
{ field: 'code', header: 'Code' },
|
|
4129
|
+
{ field: 'name', header: 'Name' },
|
|
4130
|
+
{ field: 'category', header: 'Category' },
|
|
4131
|
+
{ field: 'quantity', header: 'Quantity' }
|
|
4132
|
+
];
|
|
4133
|
+
}
|
|
4134
|
+
|
|
4135
|
+
getSeverity(status: string) {
|
|
4136
|
+
switch (status) {
|
|
4137
|
+
case 'INSTOCK':
|
|
4138
|
+
return 'success';
|
|
4139
|
+
case 'LOWSTOCK':
|
|
4140
|
+
return 'warn';
|
|
4141
|
+
case 'OUTOFSTOCK':
|
|
4142
|
+
return 'danger';
|
|
4143
|
+
}
|
|
4144
|
+
}
|
|
4145
|
+
}
|
|
4146
|
+
```
|
|
4147
|
+
|
|
4148
|
+
## verticalscroll-doc
|
|
4149
|
+
|
|
4150
|
+
```typescript
|
|
4151
|
+
import { Component, OnInit, inject } from '@angular/core';
|
|
4152
|
+
import { TableModule } from '@exhaustive-ui/core/table';
|
|
4153
|
+
import { CustomerService } from '@/service/customerservice';
|
|
4154
|
+
import { Customer, Representative, Country } from '@/domain/customer';
|
|
4155
|
+
|
|
4156
|
+
@Component({
|
|
4157
|
+
template: `
|
|
4158
|
+
<div class="card">
|
|
4159
|
+
<p-table [value]="customers" [scrollable]="true" scrollHeight="400px" [tableStyle]="{ 'min-width': '50rem' }">
|
|
4160
|
+
<ng-template #header>
|
|
4161
|
+
<tr>
|
|
4162
|
+
<th>Name</th>
|
|
4163
|
+
<th>Country</th>
|
|
4164
|
+
<th>Company</th>
|
|
4165
|
+
<th>Representative</th>
|
|
4166
|
+
</tr>
|
|
4167
|
+
</ng-template>
|
|
4168
|
+
<ng-template #body let-customer let-index="index">
|
|
4169
|
+
<tr>
|
|
4170
|
+
<td>{{ customer.name }}</td>
|
|
4171
|
+
<td>{{ customer.country.name }}</td>
|
|
4172
|
+
<td>{{ customer.company }}</td>
|
|
4173
|
+
<td>{{ customer.representative.name }}</td>
|
|
4174
|
+
</tr>
|
|
4175
|
+
</ng-template>
|
|
4176
|
+
</p-table>
|
|
4177
|
+
</div>
|
|
4178
|
+
`,
|
|
4179
|
+
standalone: true,
|
|
4180
|
+
imports: [TableModule],
|
|
4181
|
+
providers: [CustomerService]
|
|
4182
|
+
})
|
|
4183
|
+
export class TableVerticalscrollDemo implements OnInit {
|
|
4184
|
+
private customerService = inject(CustomerService);
|
|
4185
|
+
customers!: Customer[];
|
|
4186
|
+
|
|
4187
|
+
ngOnInit() {
|
|
4188
|
+
this.customerService.getCustomersMedium().then((data) => {
|
|
4189
|
+
this.customers = data;
|
|
4190
|
+
});
|
|
4191
|
+
}
|
|
4192
|
+
}
|
|
4193
|
+
```
|
|
4194
|
+
|
|
4195
|
+
## virtualscroll-doc
|
|
4196
|
+
|
|
4197
|
+
Virtual Scrolling is an efficient way to render large amount data. Usage is similar to regular scrolling with the addition of virtualScrollerOptions property to define a fixed itemSize . Internally, VirtualScroller component is utilized so 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
|
+
|
|
4199
|
+
```typescript
|
|
4200
|
+
import { Component, OnInit, inject } from '@angular/core';
|
|
4201
|
+
import { Table, TableModule } from '@exhaustive-ui/core/table';
|
|
4202
|
+
import { CarService } from '@/service/carservice';
|
|
4203
|
+
import { Car } from '@/domain/car';
|
|
4204
|
+
|
|
4205
|
+
interface Column {
|
|
4206
|
+
field: string;
|
|
4207
|
+
header: string;
|
|
4208
|
+
}
|
|
4209
|
+
|
|
4210
|
+
@Component({
|
|
4211
|
+
template: `
|
|
4212
|
+
<div class="card">
|
|
4213
|
+
<p-table [columns]="cols" [value]="cars" [scrollable]="true" scrollHeight="400px" [virtualScroll]="true" [virtualScrollItemSize]="46">
|
|
4214
|
+
<ng-template #header let-columns>
|
|
4215
|
+
<tr>
|
|
4216
|
+
<th *ngFor="let col of columns" style="width: 20%;">
|
|
4217
|
+
{{ col.header }}
|
|
4218
|
+
</th>
|
|
4219
|
+
</tr>
|
|
4220
|
+
</ng-template>
|
|
4221
|
+
<ng-template #body let-rowData let-rowIndex="rowIndex" let-columns="columns">
|
|
4222
|
+
<tr style="height:46px">
|
|
4223
|
+
<td *ngFor="let col of columns">
|
|
4224
|
+
{{ rowData[col.field] }}
|
|
4225
|
+
</td>
|
|
4226
|
+
</tr>
|
|
4227
|
+
</ng-template>
|
|
4228
|
+
</p-table>
|
|
4229
|
+
</div>
|
|
4230
|
+
`,
|
|
4231
|
+
standalone: true,
|
|
4232
|
+
imports: [TableModule],
|
|
4233
|
+
providers: [CarService]
|
|
4234
|
+
})
|
|
4235
|
+
export class TableVirtualscrollDemo implements OnInit {
|
|
4236
|
+
private carService = inject(CarService);
|
|
4237
|
+
cars!: Car[];
|
|
4238
|
+
virtualCars!: Car[];
|
|
4239
|
+
cols!: Column[];
|
|
4240
|
+
|
|
4241
|
+
ngOnInit() {
|
|
4242
|
+
this.cols = [
|
|
4243
|
+
{ field: 'id', header: 'Id' },
|
|
4244
|
+
{ field: 'vin', header: 'Vin' },
|
|
4245
|
+
{ field: 'year', header: 'Year' },
|
|
4246
|
+
{ field: 'brand', header: 'Brand' },
|
|
4247
|
+
{ field: 'color', header: 'Color' }
|
|
4248
|
+
];
|
|
4249
|
+
this.cars = Array.from({ length: 10000 }).map((_, i) => this.carService.generateCar(i + 1));
|
|
4250
|
+
this.virtualCars = Array.from({ length: 10000 });
|
|
4251
|
+
}
|
|
4252
|
+
}
|
|
4253
|
+
```
|
|
4254
|
+
|
|
4255
|
+
## virtualscrolllazy-doc
|
|
4256
|
+
|
|
4257
|
+
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
|
+
|
|
4259
|
+
```typescript
|
|
4260
|
+
import { Component, OnInit, inject } from '@angular/core';
|
|
4261
|
+
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';
|
|
4265
|
+
import { Car } from '@/domain/car';
|
|
4266
|
+
|
|
4267
|
+
interface Column {
|
|
4268
|
+
field: string;
|
|
4269
|
+
header: string;
|
|
4270
|
+
}
|
|
4271
|
+
|
|
4272
|
+
@Component({
|
|
4273
|
+
template: `
|
|
4274
|
+
<div class="card">
|
|
4275
|
+
<p-table [columns]="cols" [value]="virtualCars" [scrollable]="true" scrollHeight="400px" [rows]="100" [virtualScroll]="true" [virtualScrollItemSize]="46" [lazy]="true" (onLazyLoad)="loadCarsLazy($event)">
|
|
4276
|
+
<ng-template #header let-columns>
|
|
4277
|
+
<tr>
|
|
4278
|
+
<th *ngFor="let col of columns" style="width: 20%;">
|
|
4279
|
+
{{ col.header }}
|
|
4280
|
+
</th>
|
|
4281
|
+
</tr>
|
|
4282
|
+
</ng-template>
|
|
4283
|
+
<ng-template #body let-rowData let-columns="columns">
|
|
4284
|
+
<tr style="height:46px">
|
|
4285
|
+
<td *ngFor="let col of columns">
|
|
4286
|
+
{{ rowData[col.field] }}
|
|
4287
|
+
</td>
|
|
4288
|
+
</tr>
|
|
4289
|
+
</ng-template>
|
|
4290
|
+
<ng-template #loadingbody let-columns="columns">
|
|
4291
|
+
<tr style="height:46px">
|
|
4292
|
+
<td *ngFor="let col of columns; let even = even">
|
|
4293
|
+
<p-skeleton [ngStyle]="{ width: even ? (col.field === 'year' ? '30%' : '40%') : '60%' }" />
|
|
4294
|
+
</td>
|
|
4295
|
+
</tr>
|
|
4296
|
+
</ng-template>
|
|
4297
|
+
</p-table>
|
|
4298
|
+
</div>
|
|
4299
|
+
`,
|
|
4300
|
+
standalone: true,
|
|
4301
|
+
imports: [SkeletonModule, TableModule],
|
|
4302
|
+
providers: [CarService]
|
|
4303
|
+
})
|
|
4304
|
+
export class TableVirtualscrolllazyDemo implements OnInit {
|
|
4305
|
+
private carService = inject(CarService);
|
|
4306
|
+
cars!: Car[];
|
|
4307
|
+
virtualCars!: Car[];
|
|
4308
|
+
cols!: Column[];
|
|
4309
|
+
|
|
4310
|
+
ngOnInit() {
|
|
4311
|
+
this.cols = [
|
|
4312
|
+
{ field: 'id', header: 'Id' },
|
|
4313
|
+
{ field: 'vin', header: 'Vin' },
|
|
4314
|
+
{ field: 'year', header: 'Year' },
|
|
4315
|
+
{ field: 'brand', header: 'Brand' },
|
|
4316
|
+
{ field: 'color', header: 'Color' }
|
|
4317
|
+
];
|
|
4318
|
+
this.cars = Array.from({ length: 10000 }).map((_, i) => this.carService.generateCar(i + 1));
|
|
4319
|
+
this.virtualCars = Array.from({ length: 10000 });
|
|
4320
|
+
}
|
|
4321
|
+
|
|
4322
|
+
loadCarsLazy(event: TableLazyLoadEvent) {
|
|
4323
|
+
//simulate remote connection with a timeout
|
|
4324
|
+
setTimeout(
|
|
4325
|
+
() => {
|
|
4326
|
+
//load data of required page
|
|
4327
|
+
let loadedCars = this.cars.slice(event.first, event.first + event.rows);
|
|
4328
|
+
|
|
4329
|
+
//populate page of virtual cars
|
|
4330
|
+
Array.prototype.splice.apply(this.virtualCars, [...[event.first, event.rows], ...loadedCars]);
|
|
4331
|
+
|
|
4332
|
+
//trigger change detection
|
|
4333
|
+
event.forceUpdate();
|
|
4334
|
+
},
|
|
4335
|
+
Math.random() * 1000 + 250
|
|
4336
|
+
);
|
|
4337
|
+
}
|
|
4338
|
+
}
|
|
4339
|
+
```
|
|
4340
|
+
|
|
4341
|
+
## Table
|
|
4342
|
+
|
|
4343
|
+
Table displays data in tabular format.
|
|
4344
|
+
|
|
4345
|
+
### Props
|
|
4346
|
+
|
|
4347
|
+
| Name | Type | Default | Description |
|
|
4348
|
+
|------|------|---------|-------------|
|
|
4349
|
+
| dt | InputSignal<Object> | undefined | Defines scoped design tokens of the component. |
|
|
4350
|
+
| unstyled | InputSignal<boolean> | undefined | Indicates whether the component should be rendered without styles. |
|
|
4351
|
+
| pt | InputSignal<TablePassThrough> | undefined | Used to pass attributes to DOM elements inside the component. |
|
|
4352
|
+
| ptOptions | InputSignal<PassThroughOptions> | undefined | Used to configure passthrough(pt) options of the component. |
|
|
4353
|
+
| frozenValue | InputSignal<any[]> | ... | An array of objects to display as frozen. |
|
|
4354
|
+
| tableStyle | InputSignal<{ [klass: string]: any }> | ... | Inline style of the table. |
|
|
4355
|
+
| tableStyleClass | InputSignal<string> | ... | Style class of the table. |
|
|
4356
|
+
| paginator | InputSignalWithTransform<boolean, unknown> | ... | When specified as true, enables the pagination. |
|
|
4357
|
+
| pageLinks | InputSignalWithTransform<number, unknown> | ... | Number of page links to display in paginator. |
|
|
4358
|
+
| rowsPerPageOptions | InputSignal<any[]> | ... | Array of integer/object values to display inside rows per page dropdown of paginator |
|
|
4359
|
+
| alwaysShowPaginator | InputSignalWithTransform<boolean, unknown> | ... | Whether to show it even there is only one page. |
|
|
4360
|
+
| paginatorPosition | InputSignal<"top" \| "bottom" \| "both"> | ... | Position of the paginator, options are "top", "bottom" or "both". |
|
|
4361
|
+
| paginatorStyleClass | InputSignal<string> | ... | Custom style class for paginator |
|
|
4362
|
+
| paginatorDropdownAppendTo | InputSignal<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). |
|
|
4363
|
+
| paginatorDropdownScrollHeight | InputSignal<string> | ... | Paginator dropdown height of the viewport in pixels, a scrollbar is defined if height of list exceeds this value. |
|
|
4364
|
+
| currentPageReportTemplate | InputSignal<string> | ... | Template of the current page report element. Available placeholders are {currentPage},{totalPages},{rows},{first},{last} and {totalRecords} |
|
|
4365
|
+
| showCurrentPageReport | InputSignalWithTransform<boolean, unknown> | ... | Whether to display current page report. |
|
|
4366
|
+
| showJumpToPageDropdown | InputSignalWithTransform<boolean, unknown> | ... | Whether to display a dropdown to navigate to any page. |
|
|
4367
|
+
| showJumpToPageInput | InputSignalWithTransform<boolean, unknown> | ... | Whether to display a input to navigate to any page. |
|
|
4368
|
+
| showFirstLastIcon | InputSignalWithTransform<boolean, unknown> | ... | When enabled, icons are displayed on paginator to go first and last page. |
|
|
4369
|
+
| showPageLinks | InputSignalWithTransform<boolean, unknown> | ... | Whether to show page links. |
|
|
4370
|
+
| defaultSortOrder | InputSignalWithTransform<number, unknown> | ... | Sort order to use when an unsorted column gets sorted by user interaction. |
|
|
4371
|
+
| sortMode | InputSignal<"multiple" \| "single"> | ... | Defines whether sorting works on single column or on multiple columns. |
|
|
4372
|
+
| resetPageOnSort | InputSignalWithTransform<boolean, unknown> | ... | When true, resets paginator to first page after sorting. Available only when sortMode is set to single. |
|
|
4373
|
+
| selectionMode | InputSignal<"multiple" \| "single"> | ... | Specifies the selection mode, valid values are "single" and "multiple". |
|
|
4374
|
+
| selectionPageOnly | InputSignalWithTransform<boolean, unknown> | ... | When enabled with paginator and checkbox selection mode, the select all checkbox in the header will select all rows on the current page. |
|
|
4375
|
+
| contextMenuSelection | ModelSignal<any> | ... | Selected row with a context menu, supports one or two-way binding. Emits `contextMenuSelectionChange` with the row data on context menu selection change. |
|
|
4376
|
+
| contextMenuSelectionMode | InputSignal<string> | ... | 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. |
|
|
4377
|
+
| dataKey | InputSignal<string> | ... | A property to uniquely identify a record in data. |
|
|
4378
|
+
| metaKeySelection | InputSignalWithTransform<boolean, unknown> | ... | Defines whether metaKey should be considered for the selection. On touch enabled devices, metaKeySelection is turned off automatically. |
|
|
4379
|
+
| rowSelectable | InputSignal<(row: { data: any; index: number }) => boolean> | ... | Defines if the row is selectable. |
|
|
4380
|
+
| rowTrackBy | InputSignal<Function> | ... | Function to optimize the dom operations by delegating to ngForTrackBy, default algorithm checks for object identity. |
|
|
4381
|
+
| lazy | InputSignalWithTransform<boolean, unknown> | ... | Defines if data is loaded and interacted with in lazy manner. |
|
|
4382
|
+
| lazyLoadOnInit | InputSignalWithTransform<boolean, unknown> | ... | Whether to call lazy loading on initialization. |
|
|
4383
|
+
| compareSelectionBy | InputSignal<"equals" \| "deepEquals"> | ... | Algorithm to define if a row is selected, valid values are "equals" that compares by reference and "deepEquals" that compares all fields. |
|
|
4384
|
+
| csvSeparator | InputSignal<string> | ... | Character to use as the csv separator. |
|
|
4385
|
+
| exportFilename | InputSignal<string> | ... | Name of the exported file. |
|
|
4386
|
+
| filters | InputSignal<{ [s: string]: FilterMetadata \| FilterMetadata[] }> | ... | An array of FilterMetadata objects to provide external filters. |
|
|
4387
|
+
| globalFilterFields | InputSignal<string[]> | ... | An array of fields as string to use in global filtering. |
|
|
4388
|
+
| filterDelay | InputSignalWithTransform<number, unknown> | ... | Delay in milliseconds before filtering the data. |
|
|
4389
|
+
| filterLocale | InputSignal<string> | ... | Locale to use in filtering. The default locale is the host environment's current locale. |
|
|
4390
|
+
| expandedRowKeys | InputSignal<{ [s: string]: boolean }> | ... | Map instance to keep the expanded rows where key of the map is the data key of the row. |
|
|
4391
|
+
| editingRowKeys | InputSignal<{ [s: string]: boolean }> | ... | Map instance to keep the rows being edited where key of the map is the data key of the row. |
|
|
4392
|
+
| rowExpandMode | InputSignal<"multiple" \| "single"> | ... | Whether multiple rows can be expanded at any time. Valid values are "multiple" and "single". |
|
|
4393
|
+
| scrollable | InputSignalWithTransform<boolean, unknown> | ... | Enables scrollable tables. |
|
|
4394
|
+
| rowGroupMode | InputSignal<"subheader" \| "rowspan"> | ... | Type of the row grouping, valid values are "subheader" and "rowspan". |
|
|
4395
|
+
| scrollHeight | InputSignal<string> | ... | Height of the scroll viewport in fixed pixels or the "flex" keyword for a dynamic size. |
|
|
4396
|
+
| virtualScroll | InputSignalWithTransform<boolean, unknown> | ... | Whether the data should be loaded on demand during scroll. |
|
|
4397
|
+
| virtualScrollItemSize | InputSignalWithTransform<number, unknown> | ... | Height of a row to use in calculations of virtual scrolling. |
|
|
4398
|
+
| virtualScrollOptions | InputSignal<ScrollerOptions> | ... | Whether to use the scroller feature. The properties of scroller component can be used like an object in it. |
|
|
4399
|
+
| virtualScrollDelay | InputSignalWithTransform<number, unknown> | ... | Threshold in milliseconds to delay lazy loading during scrolling. |
|
|
4400
|
+
| contextMenu | InputSignal<any> | ... | Local ng-template varilable of a ContextMenu. |
|
|
4401
|
+
| resizableColumns | InputSignalWithTransform<boolean, unknown> | ... | When enabled, columns can be resized using drag and drop. |
|
|
4402
|
+
| columnResizeMode | InputSignal<string> | ... | Defines whether the overall table width should change on column resize, valid values are "fit" and "expand". |
|
|
4403
|
+
| reorderableColumns | InputSignalWithTransform<boolean, unknown> | ... | When enabled, columns can be reordered using drag and drop. |
|
|
4404
|
+
| loading | InputSignalWithTransform<boolean, unknown> | ... | Displays a loader to indicate data load is in progress. |
|
|
4405
|
+
| loadingIcon | InputSignal<string> | ... | The icon to show while indicating data load is in progress. |
|
|
4406
|
+
| showLoader | InputSignalWithTransform<boolean, unknown> | ... | Whether to show the loading mask when loading property is true. |
|
|
4407
|
+
| rowHover | InputSignalWithTransform<boolean, unknown> | ... | 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. |
|
|
4408
|
+
| customSort | InputSignalWithTransform<boolean, unknown> | ... | Whether to use the default sorting or a custom one using sortFunction. |
|
|
4409
|
+
| showInitialSortBadge | InputSignalWithTransform<boolean, unknown> | ... | Whether to use the initial sort badge or not. |
|
|
4410
|
+
| exportFunction | InputSignal<Function> | ... | Export function. |
|
|
4411
|
+
| exportHeader | InputSignal<string> | ... | Custom export header of the column to be exported as CSV. |
|
|
4412
|
+
| stateKey | InputSignal<string> | ... | Unique identifier of a stateful table to use in state storage. |
|
|
4413
|
+
| stateStorage | InputSignal<"session" \| "local"> | ... | Defines where a stateful table keeps its state, valid values are "session" for sessionStorage and "local" for localStorage. |
|
|
4414
|
+
| editMode | InputSignal<"row" \| "cell"> | ... | Defines the editing mode, valid values are "cell" and "row". |
|
|
4415
|
+
| groupRowsBy | InputSignal<any> | ... | Field name to use in row grouping. |
|
|
4416
|
+
| size | InputSignal<"small" \| "large"> | ... | Defines the size of the table. |
|
|
4417
|
+
| showGridlines | InputSignalWithTransform<boolean, unknown> | ... | Whether to show grid lines between cells. |
|
|
4418
|
+
| stripedRows | InputSignalWithTransform<boolean, unknown> | ... | Whether to display rows with alternating colors. |
|
|
4419
|
+
| groupRowsByOrder | InputSignalWithTransform<number, unknown> | ... | Order to sort when default row grouping is enabled. |
|
|
4420
|
+
| responsiveLayout | InputSignal<string> | ... | Defines the responsive mode, valid options are "stack" and "scroll". **(Deprecated)** |
|
|
4421
|
+
| breakpoint | InputSignal<string> | ... | The breakpoint to define the maximum width boundary when using stack responsive layout. |
|
|
4422
|
+
| paginatorLocale | InputSignal<string> | ... | Locale to be used in paginator formatting. |
|
|
4423
|
+
| value | InputSignal<RowData[]> | ... | An array of objects to display. |
|
|
4424
|
+
| columns | InputSignal<any[]> | ... | An array of objects to represent dynamic columns. |
|
|
4425
|
+
| first | ModelSignal<number> | ... | Index of the first row to be displayed, supports one or two-way binding. Emits `firstChange` with the first element on pagination. |
|
|
4426
|
+
| rows | ModelSignal<number> | ... | Number of rows to display per page, supports one or two-way binding. Emits `rowsChange` with the row count on rows change. |
|
|
4427
|
+
| totalRecords | InputSignal<number> | ... | Number of total records, defaults to length of value when not defined. |
|
|
4428
|
+
| sortField | InputSignal<string> | ... | Name of the field to sort data by default. |
|
|
4429
|
+
| sortOrder | InputSignal<number> | ... | Order to sort when default sorting is enabled. |
|
|
4430
|
+
| multiSortMeta | InputSignal<SortMeta[]> | ... | An array of SortMeta objects to sort the data by default in multiple sort mode. |
|
|
4431
|
+
| selection | ModelSignal<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. |
|
|
4432
|
+
| selectAll | InputSignal<boolean> | ... | Whether all data is selected. |
|
|
4433
|
+
|
|
4434
|
+
### Emits
|
|
4435
|
+
|
|
4436
|
+
| Name | Parameters | Description |
|
|
4437
|
+
|------|------------|-------------|
|
|
4438
|
+
| selectAllChange | event: TableSelectAllChangeEvent | Emits when the all of the items selected or unselected. |
|
|
4439
|
+
| onRowSelect | event: TableRowSelectEvent<RowData | Callback to invoke when a row is selected. |
|
|
4440
|
+
| onRowUnselect | event: TableRowUnSelectEvent<RowData | Callback to invoke when a row is unselected. |
|
|
4441
|
+
| onPage | event: TablePageEvent | Callback to invoke when pagination occurs. |
|
|
4442
|
+
| onSort | value: any | Callback to invoke when a column gets sorted. |
|
|
4443
|
+
| onFilter | event: TableFilterEvent | Callback to invoke when data is filtered. |
|
|
4444
|
+
| onLazyLoad | event: TableLazyLoadEvent | Callback to invoke when paging, sorting or filtering happens in lazy mode. |
|
|
4445
|
+
| onRowExpand | event: TableRowExpandEvent<RowData | Callback to invoke when a row is expanded. |
|
|
4446
|
+
| onRowCollapse | event: TableRowCollapseEvent | Callback to invoke when a row is collapsed. |
|
|
4447
|
+
| onContextMenuSelect | event: TableContextMenuSelectEvent<RowData | Callback to invoke when a row is selected with right click. |
|
|
4448
|
+
| onColResize | event: TableColResizeEvent | Callback to invoke when a column is resized. |
|
|
4449
|
+
| onColReorder | event: TableColumnReorderEvent | Callback to invoke when a column is reordered. |
|
|
4450
|
+
| onRowReorder | event: TableRowReorderEvent | Callback to invoke when a row is reordered. |
|
|
4451
|
+
| onEditInit | event: TableEditInitEvent | Callback to invoke when a cell switches to edit mode. |
|
|
4452
|
+
| onEditComplete | event: TableEditCompleteEvent | Callback to invoke when cell edit is completed. |
|
|
4453
|
+
| onEditCancel | event: TableEditCancelEvent | Callback to invoke when cell edit is cancelled with escape key. |
|
|
4454
|
+
| onHeaderCheckboxToggle | event: TableHeaderCheckboxToggleEvent | Callback to invoke when state of header checkbox changes. |
|
|
4455
|
+
| sortFunction | value: any | A function to implement custom sorting, refer to sorting section for details. |
|
|
4456
|
+
| onStateSave | value: TableState | Callback to invoke table state is saved. |
|
|
4457
|
+
| onStateRestore | value: TableState | Callback to invoke table state is restored. |
|
|
4458
|
+
|
|
4459
|
+
### Methods
|
|
4460
|
+
|
|
4461
|
+
| Name | Parameters | Return Type | Description |
|
|
4462
|
+
|------|------------|-------------|-------------|
|
|
4463
|
+
| exportCSV | options: ExportCSVOptions | void | Data export method. |
|
|
4464
|
+
| resetScrollTop | | void | Resets scroll to top. |
|
|
4465
|
+
| scrollToVirtualIndex | index: number | void | Scrolls to given index when using virtual scroll. |
|
|
4466
|
+
| scrollTo | options: any | void | Scrolls to given index. |
|
|
4467
|
+
|
|
4468
|
+
## Pass Through Options
|
|
4469
|
+
|
|
4470
|
+
| Name | Type | Description |
|
|
4471
|
+
|------|------|-------------|
|
|
4472
|
+
| filter | PassThroughOption<HTMLDivElement, I> | Used to pass attributes to the filter container element. |
|
|
4473
|
+
| pcColumnFilterButton | ButtonPassThrough | Used to pass attributes to the column filter button component. |
|
|
4474
|
+
| filterOverlay | PassThroughOption<HTMLDivElement, I> | Used to pass attributes to the filter overlay element. |
|
|
4475
|
+
| filterConstraintList | PassThroughOption<HTMLUListElement, I> | Used to pass attributes to the filter constraint list element. |
|
|
4476
|
+
| filterConstraint | PassThroughOption<HTMLLIElement, I> | Used to pass attributes to the filter constraint element. |
|
|
4477
|
+
| filterConstraintSeparator | PassThroughOption<HTMLLIElement, I> | Used to pass attributes to the filter constraint separator element. |
|
|
4478
|
+
| emtpyFilterLabel | PassThroughOption<HTMLLIElement, I> | Used to pass attributes to the empty filter label element. |
|
|
4479
|
+
| filterOperator | PassThroughOption<HTMLDivElement, I> | Used to pass attributes to the filter operator element. |
|
|
4480
|
+
| pcFilterOperatorDropdown | SelectPassThrough | Used to pass attributes to the filter operator dropdown component. |
|
|
4481
|
+
| filterRuleList | PassThroughOption<HTMLDivElement, I> | Used to pass attributes to the filter rule list element. |
|
|
4482
|
+
| filterRule | PassThroughOption<HTMLDivElement, I> | Used to pass attributes to the filter rule element. |
|
|
4483
|
+
| pcFilterConstraintDropdown | SelectPassThrough | Used to pass attributes to the filter constraint dropdown component. |
|
|
4484
|
+
| pcFilterRemoveRuleButton | ButtonPassThrough | Used to pass attributes to the filter remove rule button component. |
|
|
4485
|
+
| pcAddRuleButtonLabel | ButtonPassThrough | Used to pass attributes to the add rule button label. |
|
|
4486
|
+
| filterButtonBar | PassThroughOption<HTMLDivElement, I> | Used to pass attributes to the filter button bar element. |
|
|
4487
|
+
| pcFilterClearButton | ButtonPassThrough | Used to pass attributes to the filter clear button component. |
|
|
4488
|
+
| pcFilterApplyButton | ButtonPassThrough | Used to pass attributes to the filter apply button component. |
|
|
4489
|
+
| pcFilterInputText | InputTextPassThrough | Used to pass attributes to the filter input text component. |
|
|
4490
|
+
| pcFilterInputNumber | InputNumberPassThrough | Used to pass attributes to the filter input number component. |
|
|
4491
|
+
| pcFilterCheckbox | CheckboxPassThrough | Used to pass attributes to the filter checkbox component. |
|
|
4492
|
+
| pcFilterDatePicker | DatePickerPassThrough | Used to pass attributes to the filter datepicker component. |
|
|
4493
|
+
| motion | MotionOptions | Used to pass options to the motion component/directive. |
|
|
4494
|
+
|
|
4495
|
+
## Theming
|
|
4496
|
+
|
|
4497
|
+
### CSS Classes
|
|
4498
|
+
|
|
4499
|
+
| Class | Description |
|
|
4500
|
+
|-------|-------------|
|
|
4501
|
+
| p-datatable | Class name of the root element |
|
|
4502
|
+
| p-datatable-mask | Class name of the mask element |
|
|
4503
|
+
| p-datatable-loading-icon | Class name of the loading icon element |
|
|
4504
|
+
| p-datatable-header | Class name of the header element |
|
|
4505
|
+
| p-datatable-paginator-[position] | Class name of the paginator element |
|
|
4506
|
+
| p-datatable-table-container | Class name of the table container element |
|
|
4507
|
+
| p-datatable-table | Class name of the table element |
|
|
4508
|
+
| p-datatable-thead | Class name of the thead element |
|
|
4509
|
+
| p-datatable-column-resizer | Class name of the column resizer element |
|
|
4510
|
+
| p-datatable-column-header-content | Class name of the column header content element |
|
|
4511
|
+
| p-datatable-column-title | Class name of the column title element |
|
|
4512
|
+
| p-datatable-sort-icon | Class name of the sort icon element |
|
|
4513
|
+
| p-datatable-sort-badge | Class name of the sort badge element |
|
|
4514
|
+
| p-datatable-filter | Class name of the filter element |
|
|
4515
|
+
| p-datatable-filter-element-container | Class name of the filter element container element |
|
|
4516
|
+
| p-datatable-column-filter-button | Class name of the column filter button element |
|
|
4517
|
+
| p-datatable-column-filter-clear-button | Class name of the column filter clear button element |
|
|
4518
|
+
| p-datatable-filter-overlay | Class name of the filter overlay element |
|
|
4519
|
+
| p-datatable-filter-constraint-list | Class name of the filter constraint list element |
|
|
4520
|
+
| p-datatable-filter-constraint | Class name of the filter constraint element |
|
|
4521
|
+
| p-datatable-filter-constraint-separator | Class name of the filter constraint separator element |
|
|
4522
|
+
| p-datatable-filter-operator | Class name of the filter operator element |
|
|
4523
|
+
| p-datatable-filter-operator-dropdown | Class name of the filter operator dropdown element |
|
|
4524
|
+
| p-datatable-filter-rule-list | Class name of the filter rule list element |
|
|
4525
|
+
| p-datatable-filter-rule | Class name of the filter rule element |
|
|
4526
|
+
| p-datatable-filter-constraint-dropdown | Class name of the filter constraint dropdown element |
|
|
4527
|
+
| p-datatable-filter-remove-rule-button | Class name of the filter remove rule button element |
|
|
4528
|
+
| p-datatable-filter-add-rule-button | Class name of the filter add rule button element |
|
|
4529
|
+
| p-datatable-filter-buttonbar | Class name of the filter buttonbar element |
|
|
4530
|
+
| p-datatable-filter-clear-button | Class name of the filter clear button element |
|
|
4531
|
+
| p-datatable-filter-apply-button | Class name of the filter apply button element |
|
|
4532
|
+
| p-datatable-tbody | Class name of the tbody element |
|
|
4533
|
+
| p-datatable-row-group-header | Class name of the row group header element |
|
|
4534
|
+
| p-datatable-row-toggle-button | Class name of the row toggle button element |
|
|
4535
|
+
| p-datatable-row-toggle-icon | Class name of the row toggle icon element |
|
|
4536
|
+
| p-datatable-row-expansion | Class name of the row expansion element |
|
|
4537
|
+
| p-datatable-row-group-footer | Class name of the row group footer element |
|
|
4538
|
+
| p-datatable-empty-message | Class name of the empty message element |
|
|
4539
|
+
| p-datatable-reorderable-row-handle | Class name of the reorderable row handle element |
|
|
4540
|
+
| p-datatable-row-editor-init | Class name of the row editor init element |
|
|
4541
|
+
| p-datatable-row-editor-save | Class name of the row editor save element |
|
|
4542
|
+
| p-datatable-row-editor-cancel | Class name of the row editor cancel element |
|
|
4543
|
+
| p-datatable-tfoot | Class name of the tfoot element |
|
|
4544
|
+
| p-datatable-virtualscroller-spacer | Class name of the virtual scroller spacer element |
|
|
4545
|
+
| p-datatable-footer | Class name of the footer element |
|
|
4546
|
+
| p-datatable-column-resize-indicator | Class name of the column resize indicator element |
|
|
4547
|
+
| p-datatable-row-reorder-indicator-up | Class name of the row reorder indicator up element |
|
|
4548
|
+
| p-datatable-row-reorder-indicator-down | Class name of the row reorder indicator down element |
|
|
4549
|
+
| p-datatable-sortable-column | Class name of the sortable column element |
|
|
4550
|
+
| p-sortable-column-icon | Class name of the sortable column icon element |
|
|
4551
|
+
| p-sortable-column-badge | Class name of the sortable column badge element |
|
|
4552
|
+
| p-datatable-selectable-row | Class name of the selectable row element |
|
|
4553
|
+
| p-datatable-resizable-column | Class name of the resizable column element |
|
|
4554
|
+
| p-datatable-row-editor-cancel | Class name of the row editor cancel element |
|
|
4555
|
+
| p-datatable-frozen-column | Class name of the frozen column element |
|
|
4556
|
+
| p-datatable-contextmenu-row-selected | Class name of the contextmenu row selected element |
|
|
4557
|
+
|