angular-slickgrid 4.1.2 → 4.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.browserslistrc +12 -0
- package/.codecov.yml +17 -0
- package/.editorconfig +18 -0
- package/.eslintrc.json +50 -0
- package/.github/CODE_OF_CONDUCT.md +76 -0
- package/.github/FUNDING.yml +8 -0
- package/.github/ISSUE_TEMPLATE/bug_report.yml +54 -0
- package/.github/ISSUE_TEMPLATE/config.yml +5 -0
- package/.github/ISSUE_TEMPLATE/feature_request.yml +44 -0
- package/.github/renovate.json5 +26 -0
- package/.github/stale.yml +7 -0
- package/.github/workflows/main.yml +83 -0
- package/.vscode/extensions.json +9 -0
- package/.vscode/launch.json +72 -0
- package/.vscode/settings.json +7 -0
- package/.vscode/tasks.json +77 -0
- package/CHANGELOG.md +1172 -0
- package/LICENSE +20 -20
- package/README.md +9 -7
- package/angular.json +148 -0
- package/dist/LICENSE +20 -0
- package/dist/README.md +182 -0
- package/{angular-slickgrid.d.ts → dist/angular-slickgrid.d.ts} +0 -0
- package/{app → dist/app}/modules/angular-slickgrid/components/angular-slickgrid.component.d.ts +0 -0
- package/{app → dist/app}/modules/angular-slickgrid/constants.d.ts +0 -0
- package/{app → dist/app}/modules/angular-slickgrid/extensions/index.d.ts +0 -0
- package/{app → dist/app}/modules/angular-slickgrid/extensions/slickRowDetailView.d.ts +0 -0
- package/{app → dist/app}/modules/angular-slickgrid/global-grid-options.d.ts +0 -0
- package/{app → dist/app}/modules/angular-slickgrid/index.d.ts +0 -0
- package/{app → dist/app}/modules/angular-slickgrid/models/angularComponentOutput.interface.d.ts +0 -0
- package/{app → dist/app}/modules/angular-slickgrid/models/angularGridInstance.interface.d.ts +0 -0
- package/{app → dist/app}/modules/angular-slickgrid/models/externalTestingDependencies.interface.d.ts +0 -0
- package/{app → dist/app}/modules/angular-slickgrid/models/gridOption.interface.d.ts +0 -0
- package/{app → dist/app}/modules/angular-slickgrid/models/index.d.ts +0 -0
- package/{app → dist/app}/modules/angular-slickgrid/models/rowDetailView.interface.d.ts +0 -0
- package/{app → dist/app}/modules/angular-slickgrid/models/slickGrid.interface.d.ts +0 -0
- package/{app → dist/app}/modules/angular-slickgrid/modules/angular-slickgrid.module.d.ts +0 -0
- package/{app → dist/app}/modules/angular-slickgrid/services/angularUtil.service.d.ts +0 -0
- package/{app → dist/app}/modules/angular-slickgrid/services/bsDropdown.service.d.ts +0 -0
- package/{app → dist/app}/modules/angular-slickgrid/services/container.service.d.ts +0 -0
- package/{app → dist/app}/modules/angular-slickgrid/services/index.d.ts +0 -0
- package/{app → dist/app}/modules/angular-slickgrid/services/translater.service.d.ts +0 -0
- package/{app → dist/app}/modules/angular-slickgrid/services/utilities.d.ts +0 -0
- package/{app → dist/app}/modules/angular-slickgrid/slickgrid-config.d.ts +0 -0
- package/{esm2020 → dist/esm2020}/angular-slickgrid.mjs +0 -0
- package/dist/esm2020/app/modules/angular-slickgrid/components/angular-slickgrid.component.mjs +1171 -0
- package/{esm2020 → dist/esm2020}/app/modules/angular-slickgrid/constants.mjs +1 -1
- package/{esm2020 → dist/esm2020}/app/modules/angular-slickgrid/extensions/index.mjs +1 -1
- package/{esm2020 → dist/esm2020}/app/modules/angular-slickgrid/extensions/slickRowDetailView.mjs +2 -2
- package/{esm2020 → dist/esm2020}/app/modules/angular-slickgrid/global-grid-options.mjs +1 -1
- package/{esm2020 → dist/esm2020}/app/modules/angular-slickgrid/index.mjs +1 -1
- package/{esm2020 → dist/esm2020}/app/modules/angular-slickgrid/models/angularComponentOutput.interface.mjs +1 -1
- package/dist/esm2020/app/modules/angular-slickgrid/models/angularGridInstance.interface.mjs +2 -0
- package/dist/esm2020/app/modules/angular-slickgrid/models/externalTestingDependencies.interface.mjs +2 -0
- package/dist/esm2020/app/modules/angular-slickgrid/models/gridOption.interface.mjs +2 -0
- package/{esm2020 → dist/esm2020}/app/modules/angular-slickgrid/models/index.mjs +1 -1
- package/dist/esm2020/app/modules/angular-slickgrid/models/rowDetailView.interface.mjs +2 -0
- package/dist/esm2020/app/modules/angular-slickgrid/models/slickGrid.interface.mjs +2 -0
- package/{esm2020 → dist/esm2020}/app/modules/angular-slickgrid/modules/angular-slickgrid.module.mjs +5 -5
- package/{esm2020 → dist/esm2020}/app/modules/angular-slickgrid/services/angularUtil.service.mjs +4 -4
- package/{esm2020 → dist/esm2020}/app/modules/angular-slickgrid/services/bsDropdown.service.mjs +4 -4
- package/{esm2020 → dist/esm2020}/app/modules/angular-slickgrid/services/container.service.mjs +4 -4
- package/{esm2020 → dist/esm2020}/app/modules/angular-slickgrid/services/index.mjs +1 -1
- package/{esm2020 → dist/esm2020}/app/modules/angular-slickgrid/services/translater.service.mjs +4 -4
- package/{esm2020 → dist/esm2020}/app/modules/angular-slickgrid/services/utilities.mjs +1 -1
- package/{esm2020 → dist/esm2020}/app/modules/angular-slickgrid/slickgrid-config.mjs +1 -1
- package/{esm2020 → dist/esm2020}/public_api.mjs +1 -1
- package/{fesm2015 → dist/fesm2015}/angular-slickgrid.mjs +25 -22
- package/dist/fesm2015/angular-slickgrid.mjs.map +1 -0
- package/{fesm2020 → dist/fesm2020}/angular-slickgrid.mjs +25 -22
- package/dist/fesm2020/angular-slickgrid.mjs.map +1 -0
- package/{i18n → dist/i18n}/en.json +89 -89
- package/{i18n → dist/i18n}/fr.json +90 -90
- package/dist/package.json +79 -0
- package/{public_api.d.ts → dist/public_api.d.ts} +0 -0
- package/global.d.ts +1 -0
- package/ngcc.config.js +13 -0
- package/package.json +124 -37
- package/screenshots/column-picker.png +0 -0
- package/screenshots/composite-editor.png +0 -0
- package/screenshots/draggable-grouping.png +0 -0
- package/screenshots/editors.png +0 -0
- package/screenshots/export-to-file.png +0 -0
- package/screenshots/filter_and_sort.png +0 -0
- package/screenshots/formatters.png +0 -0
- package/screenshots/frozen.png +0 -0
- package/screenshots/multipleSelectFilter.png +0 -0
- package/screenshots/pagination.png +0 -0
- package/screenshots/selectFilter.png +0 -0
- package/screenshots/singleFilter.png +0 -0
- package/src/app/app-routing.module.ts +83 -0
- package/src/app/app.component.html +160 -0
- package/src/app/app.component.scss +65 -0
- package/src/app/app.component.ts +10 -0
- package/src/app/app.module.ts +175 -0
- package/src/app/examples/custom-angularComponentEditor.ts +184 -0
- package/src/app/examples/custom-angularComponentFilter.ts +126 -0
- package/src/app/examples/custom-inputEditor.ts +124 -0
- package/src/app/examples/custom-inputFilter.ts +142 -0
- package/src/app/examples/custom-titleFormatter.component.ts +8 -0
- package/src/app/examples/editor-ng-select.component.ts +37 -0
- package/src/app/examples/filter-ng-select.component.ts +32 -0
- package/src/app/examples/grid-additem.component.html +48 -0
- package/src/app/examples/grid-additem.component.ts +272 -0
- package/src/app/examples/grid-angular.component.html +79 -0
- package/src/app/examples/grid-angular.component.scss +28 -0
- package/src/app/examples/grid-angular.component.ts +370 -0
- package/src/app/examples/grid-autoheight.component.html +52 -0
- package/src/app/examples/grid-autoheight.component.ts +147 -0
- package/src/app/examples/grid-basic.component.html +29 -0
- package/src/app/examples/grid-basic.component.ts +82 -0
- package/src/app/examples/grid-clientside.component.html +51 -0
- package/src/app/examples/grid-clientside.component.ts +293 -0
- package/src/app/examples/grid-colspan.component.html +39 -0
- package/src/app/examples/grid-colspan.component.scss +11 -0
- package/src/app/examples/grid-colspan.component.ts +155 -0
- package/src/app/examples/grid-composite-editor.component.html +79 -0
- package/src/app/examples/grid-composite-editor.component.scss +19 -0
- package/src/app/examples/grid-composite-editor.component.ts +948 -0
- package/src/app/examples/grid-contextmenu.component.html +62 -0
- package/src/app/examples/grid-contextmenu.component.scss +44 -0
- package/src/app/examples/grid-contextmenu.component.ts +473 -0
- package/src/app/examples/grid-custom-tooltip.component.html +25 -0
- package/src/app/examples/grid-custom-tooltip.component.scss +77 -0
- package/src/app/examples/grid-custom-tooltip.component.ts +483 -0
- package/src/app/examples/grid-draggrouping.component.html +93 -0
- package/src/app/examples/grid-draggrouping.component.ts +397 -0
- package/src/app/examples/grid-editor.component.html +88 -0
- package/src/app/examples/grid-editor.component.ts +699 -0
- package/src/app/examples/grid-formatter.component.html +26 -0
- package/src/app/examples/grid-formatter.component.ts +162 -0
- package/src/app/examples/grid-frozen.component.html +65 -0
- package/src/app/examples/grid-frozen.component.scss +11 -0
- package/src/app/examples/grid-frozen.component.ts +303 -0
- package/src/app/examples/grid-graphql-nopage.component.html +33 -0
- package/src/app/examples/grid-graphql-nopage.component.scss +9 -0
- package/src/app/examples/grid-graphql-nopage.component.ts +242 -0
- package/src/app/examples/grid-graphql.component.html +87 -0
- package/src/app/examples/grid-graphql.component.ts +304 -0
- package/src/app/examples/grid-grouping.component.html +80 -0
- package/src/app/examples/grid-grouping.component.ts +313 -0
- package/src/app/examples/grid-headerbutton.component.html +31 -0
- package/src/app/examples/grid-headerbutton.component.scss +10 -0
- package/src/app/examples/grid-headerbutton.component.ts +233 -0
- package/src/app/examples/grid-headermenu.component.html +31 -0
- package/src/app/examples/grid-headermenu.component.scss +25 -0
- package/src/app/examples/grid-headermenu.component.ts +159 -0
- package/src/app/examples/grid-localization.component.html +54 -0
- package/src/app/examples/grid-localization.component.ts +293 -0
- package/src/app/examples/grid-menu.component.html +37 -0
- package/src/app/examples/grid-menu.component.scss +28 -0
- package/src/app/examples/grid-menu.component.ts +229 -0
- package/src/app/examples/grid-odata.component.html +116 -0
- package/src/app/examples/grid-odata.component.ts +441 -0
- package/src/app/examples/grid-range.component.html +74 -0
- package/src/app/examples/grid-range.component.ts +291 -0
- package/src/app/examples/grid-remote.component.html +37 -0
- package/src/app/examples/grid-remote.component.ts +153 -0
- package/src/app/examples/grid-resize-by-content.component.html +62 -0
- package/src/app/examples/grid-resize-by-content.component.scss +19 -0
- package/src/app/examples/grid-resize-by-content.component.ts +780 -0
- package/src/app/examples/grid-rowdetail.component.html +35 -0
- package/src/app/examples/grid-rowdetail.component.ts +205 -0
- package/src/app/examples/grid-rowmove.component.html +49 -0
- package/src/app/examples/grid-rowmove.component.ts +234 -0
- package/src/app/examples/grid-rowselection.component.html +76 -0
- package/src/app/examples/grid-rowselection.component.ts +267 -0
- package/src/app/examples/grid-state.component.html +36 -0
- package/src/app/examples/grid-state.component.ts +259 -0
- package/src/app/examples/grid-tabs.component.html +35 -0
- package/src/app/examples/grid-tabs.component.ts +115 -0
- package/src/app/examples/grid-trading.component.html +58 -0
- package/src/app/examples/grid-trading.component.scss +49 -0
- package/src/app/examples/grid-trading.component.ts +319 -0
- package/src/app/examples/grid-tree-data-hierarchical.component.html +79 -0
- package/src/app/examples/grid-tree-data-hierarchical.component.scss +47 -0
- package/src/app/examples/grid-tree-data-hierarchical.component.ts +311 -0
- package/src/app/examples/grid-tree-data-parent-child.component.html +108 -0
- package/src/app/examples/grid-tree-data-parent-child.component.scss +10 -0
- package/src/app/examples/grid-tree-data-parent-child.component.ts +351 -0
- package/src/app/examples/home.component.html +41 -0
- package/src/app/examples/home.component.ts +9 -0
- package/src/app/examples/rowdetail-preload.component.ts +10 -0
- package/src/app/examples/rowdetail-view.component.html +36 -0
- package/src/app/examples/rowdetail-view.component.ts +54 -0
- package/src/app/examples/swt-common-grid-pagination.component.ts +156 -0
- package/src/app/examples/swt-common-grid-test.component.html +30 -0
- package/src/app/examples/swt-common-grid-test.component.ts +219 -0
- package/src/app/examples/swt-common-grid.component.ts +436 -0
- package/src/app/examples/swt-logger.service.ts +165 -0
- package/src/app/modules/angular-slickgrid/components/angular-slickgrid.component.html +4 -0
- package/src/app/modules/angular-slickgrid/components/angular-slickgrid.component.ts +1395 -0
- package/src/app/modules/angular-slickgrid/constants.ts +97 -0
- package/src/app/modules/angular-slickgrid/extensions/index.ts +1 -0
- package/src/app/modules/angular-slickgrid/extensions/slickRowDetailView.ts +375 -0
- package/src/app/modules/angular-slickgrid/global-grid-options.ts +245 -0
- package/src/app/modules/angular-slickgrid/index.ts +11 -0
- package/src/app/modules/angular-slickgrid/models/angularComponentOutput.interface.ts +6 -0
- package/src/app/modules/angular-slickgrid/models/angularGridInstance.interface.ts +68 -0
- package/src/app/modules/angular-slickgrid/models/externalTestingDependencies.interface.ts +37 -0
- package/src/app/modules/angular-slickgrid/models/gridOption.interface.ts +12 -0
- package/src/app/modules/angular-slickgrid/models/index.ts +6 -0
- package/src/app/modules/angular-slickgrid/models/rowDetailView.interface.ts +33 -0
- package/src/app/modules/angular-slickgrid/models/slickGrid.interface.ts +7 -0
- package/src/app/modules/angular-slickgrid/modules/angular-slickgrid.module.ts +37 -0
- package/src/app/modules/angular-slickgrid/services/angularUtil.service.ts +48 -0
- package/src/app/modules/angular-slickgrid/services/bsDropdown.service.ts +142 -0
- package/src/app/modules/angular-slickgrid/services/container.service.ts +24 -0
- package/src/app/modules/angular-slickgrid/services/index.ts +5 -0
- package/src/app/modules/angular-slickgrid/services/translater.service.ts +38 -0
- package/src/app/modules/angular-slickgrid/services/utilities.ts +19 -0
- package/src/app/modules/angular-slickgrid/slickgrid-config.ts +10 -0
- package/src/app/slickgrid-custom-variables.scss +10 -0
- package/src/assets/.gitkeep +0 -0
- package/src/assets/data/collection_100_numbers.json +12 -0
- package/src/assets/data/collection_500_numbers.json +52 -0
- package/src/assets/data/countries.json +245 -0
- package/src/assets/data/country_names.json +245 -0
- package/src/assets/data/customers_100.json +102 -0
- package/src/assets/i18n/en.json +90 -0
- package/src/assets/i18n/fr.json +91 -0
- package/src/environments/environment.prod.ts +3 -0
- package/src/environments/environment.ts +8 -0
- package/src/favicon.ico +0 -0
- package/src/index.html +18 -0
- package/src/main.ts +13 -0
- package/src/polyfills.ts +52 -0
- package/src/public_api.ts +1 -0
- package/src/styles.scss +66 -0
- package/src/typings.d.ts +10 -0
- package/tsconfig.app.json +25 -0
- package/tsconfig.json +40 -0
- package/tsconfig.spec.json +23 -0
- package/docs/assets/lib/multiple-select/README.md +0 -17
- package/esm2020/app/modules/angular-slickgrid/components/angular-slickgrid.component.mjs +0 -1168
- package/esm2020/app/modules/angular-slickgrid/models/angularGridInstance.interface.mjs +0 -2
- package/esm2020/app/modules/angular-slickgrid/models/externalTestingDependencies.interface.mjs +0 -2
- package/esm2020/app/modules/angular-slickgrid/models/gridOption.interface.mjs +0 -2
- package/esm2020/app/modules/angular-slickgrid/models/rowDetailView.interface.mjs +0 -2
- package/esm2020/app/modules/angular-slickgrid/models/slickGrid.interface.mjs +0 -2
- package/fesm2015/angular-slickgrid.mjs.map +0 -1
- package/fesm2020/angular-slickgrid.mjs.map +0 -1
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
import { ChangeDetectorRef, Component, OnInit } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
AngularGridInstance,
|
|
5
|
+
Column,
|
|
6
|
+
FieldType,
|
|
7
|
+
Filters,
|
|
8
|
+
Formatters,
|
|
9
|
+
GridOption,
|
|
10
|
+
GridStateChange
|
|
11
|
+
} from './../modules/angular-slickgrid';
|
|
12
|
+
|
|
13
|
+
@Component({
|
|
14
|
+
templateUrl: './grid-rowselection.component.html',
|
|
15
|
+
styles: ['.alert { padding: 8px; margin-bottom: 10px }', '.col-sm-1{ max-width: 70px }'],
|
|
16
|
+
})
|
|
17
|
+
export class GridRowSelectionComponent implements OnInit {
|
|
18
|
+
title = 'Example 10: Multiple Grids with Row Selection';
|
|
19
|
+
subTitle = `
|
|
20
|
+
Row selection, single or multi-select (<a href="https://github.com/ghiscoding/Angular-Slickgrid/wiki/Row-Selection" target="_blank">Wiki docs</a>).
|
|
21
|
+
<ul>
|
|
22
|
+
<li>Single Select, you can click on any cell to make the row active</li>
|
|
23
|
+
<li>Multiple Selections, you need to specifically click on the checkbox to make 1 or more selections</li>
|
|
24
|
+
<li>You can use "selectableOverride()" callback to override logic to display checkbox on every row (for example only show it every 2nd row)</li>
|
|
25
|
+
<li>NOTE: Any Row Selection(s) will be reset when using Pagination and changing Page (you will need to set it back manually if you want it back)</li>
|
|
26
|
+
</ul>
|
|
27
|
+
`;
|
|
28
|
+
|
|
29
|
+
angularGrid1!: AngularGridInstance;
|
|
30
|
+
angularGrid2!: AngularGridInstance;
|
|
31
|
+
columnDefinitions1!: Column[];
|
|
32
|
+
columnDefinitions2!: Column[];
|
|
33
|
+
gridOptions1!: GridOption;
|
|
34
|
+
gridOptions2!: GridOption;
|
|
35
|
+
dataset1!: any[];
|
|
36
|
+
dataset2!: any[];
|
|
37
|
+
gridObj1!: any;
|
|
38
|
+
gridObj2!: any;
|
|
39
|
+
isGrid2WithPagination = true;
|
|
40
|
+
selectedTitles!: any[];
|
|
41
|
+
selectedTitle!: any;
|
|
42
|
+
selectedGrid2IDs!: number[];
|
|
43
|
+
|
|
44
|
+
constructor(private cd: ChangeDetectorRef) { }
|
|
45
|
+
|
|
46
|
+
ngOnInit(): void {
|
|
47
|
+
this.prepareGrid();
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
angularGridReady1(angularGrid: AngularGridInstance) {
|
|
51
|
+
this.angularGrid1 = angularGrid;
|
|
52
|
+
this.gridObj1 = angularGrid && angularGrid.slickGrid || {};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
angularGridReady2(angularGrid: AngularGridInstance) {
|
|
56
|
+
this.angularGrid2 = angularGrid;
|
|
57
|
+
this.gridObj2 = angularGrid && angularGrid.slickGrid || {};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
prepareGrid() {
|
|
61
|
+
this.columnDefinitions1 = [
|
|
62
|
+
{ id: 'title', name: 'Title', field: 'title', sortable: true, type: FieldType.string, filterable: true },
|
|
63
|
+
{ id: 'duration', name: 'Duration (days)', field: 'duration', sortable: true, type: FieldType.number, filterable: true },
|
|
64
|
+
{ id: 'complete', name: '% Complete', field: 'percentComplete', formatter: Formatters.percentCompleteBar, type: FieldType.number, filterable: true, sortable: true },
|
|
65
|
+
{
|
|
66
|
+
id: 'start', name: 'Start', field: 'start',
|
|
67
|
+
formatter: Formatters.dateIso, exportWithFormatter: true, type: FieldType.date,
|
|
68
|
+
filterable: true, sortable: true, filter: { model: Filters.compoundDate },
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
id: 'finish', name: 'Finish', field: 'finish',
|
|
72
|
+
formatter: Formatters.dateIso, exportWithFormatter: true, type: FieldType.date,
|
|
73
|
+
filterable: true, sortable: true, filter: { model: Filters.compoundDate },
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
id: 'effort-driven', name: 'Effort Driven', field: 'effortDriven',
|
|
77
|
+
formatter: Formatters.checkmark, type: FieldType.boolean,
|
|
78
|
+
sortable: true, filterable: true,
|
|
79
|
+
filter: {
|
|
80
|
+
collection: [{ value: '', label: '' }, { value: true, label: 'true' }, { value: false, label: 'false' }],
|
|
81
|
+
model: Filters.singleSelect,
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
];
|
|
85
|
+
|
|
86
|
+
this.columnDefinitions2 = [
|
|
87
|
+
{ id: 'title', name: 'Title', field: 'title', sortable: true, type: FieldType.string, filterable: true },
|
|
88
|
+
{ id: 'duration', name: 'Duration (days)', field: 'duration', sortable: true, type: FieldType.number, filterable: true },
|
|
89
|
+
{ id: 'complete', name: '% Complete', field: 'percentComplete', formatter: Formatters.percentCompleteBar, type: FieldType.number, filterable: true, sortable: true },
|
|
90
|
+
{
|
|
91
|
+
id: 'start', name: 'Start', field: 'start',
|
|
92
|
+
formatter: Formatters.dateIso, exportWithFormatter: true, type: FieldType.date,
|
|
93
|
+
filterable: true, sortable: true, filter: { model: Filters.compoundDate },
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
id: 'finish', name: 'Finish', field: 'finish',
|
|
97
|
+
formatter: Formatters.dateIso, exportWithFormatter: true, type: FieldType.date,
|
|
98
|
+
filterable: true, sortable: true, filter: { model: Filters.compoundDate },
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
id: 'effort-driven', name: 'Effort Driven', field: 'effortDriven',
|
|
102
|
+
formatter: Formatters.checkmark, type: FieldType.boolean,
|
|
103
|
+
sortable: true, filterable: true,
|
|
104
|
+
filter: {
|
|
105
|
+
collection: [{ value: '', label: '' }, { value: true, label: 'true' }, { value: false, label: 'false' }],
|
|
106
|
+
model: Filters.singleSelect,
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
];
|
|
110
|
+
|
|
111
|
+
this.gridOptions1 = {
|
|
112
|
+
gridHeight: 225,
|
|
113
|
+
gridWidth: 800,
|
|
114
|
+
enableAutoResize: false,
|
|
115
|
+
enableCellNavigation: true,
|
|
116
|
+
enableRowSelection: true,
|
|
117
|
+
enableCheckboxSelector: true,
|
|
118
|
+
enableFiltering: true,
|
|
119
|
+
checkboxSelector: {
|
|
120
|
+
// optionally change the column index position of the icon (defaults to 0)
|
|
121
|
+
// columnIndexPosition: 1,
|
|
122
|
+
|
|
123
|
+
// remove the unnecessary "Select All" checkbox in header when in single selection mode
|
|
124
|
+
hideSelectAllCheckbox: true,
|
|
125
|
+
|
|
126
|
+
// you can override the logic for showing (or not) the expand icon
|
|
127
|
+
// for example, display the expand icon only on every 2nd row
|
|
128
|
+
// selectableOverride: (row: number, dataContext: any, grid: SlickGrid) => (dataContext.id % 2 === 1)
|
|
129
|
+
},
|
|
130
|
+
multiSelect: false,
|
|
131
|
+
rowSelectionOptions: {
|
|
132
|
+
// True (Single Selection), False (Multiple Selections)
|
|
133
|
+
selectActiveRow: true,
|
|
134
|
+
},
|
|
135
|
+
columnPicker: {
|
|
136
|
+
hideForceFitButton: true
|
|
137
|
+
},
|
|
138
|
+
gridMenu: {
|
|
139
|
+
hideForceFitButton: true
|
|
140
|
+
},
|
|
141
|
+
enablePagination: true,
|
|
142
|
+
pagination: {
|
|
143
|
+
pageSizes: [5, 10, 15, 20, 25, 50, 75, 100],
|
|
144
|
+
pageSize: 5
|
|
145
|
+
},
|
|
146
|
+
// we can use some Presets, for the example Pagination
|
|
147
|
+
presets: {
|
|
148
|
+
pagination: { pageNumber: 2, pageSize: 5 },
|
|
149
|
+
},
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
this.gridOptions2 = {
|
|
153
|
+
gridHeight: 255,
|
|
154
|
+
gridWidth: 800,
|
|
155
|
+
enableAutoResize: false,
|
|
156
|
+
enableCellNavigation: true,
|
|
157
|
+
enableFiltering: true,
|
|
158
|
+
checkboxSelector: {
|
|
159
|
+
// you can toggle these 2 properties to show the "select all" checkbox in different location
|
|
160
|
+
hideInFilterHeaderRow: false,
|
|
161
|
+
hideInColumnTitleRow: true
|
|
162
|
+
},
|
|
163
|
+
rowSelectionOptions: {
|
|
164
|
+
// True (Single Selection), False (Multiple Selections)
|
|
165
|
+
selectActiveRow: false
|
|
166
|
+
},
|
|
167
|
+
enableCheckboxSelector: true,
|
|
168
|
+
enableRowSelection: true,
|
|
169
|
+
enablePagination: true,
|
|
170
|
+
pagination: {
|
|
171
|
+
pageSizes: [5, 10, 15, 20, 25, 50, 75, 100],
|
|
172
|
+
pageSize: 5
|
|
173
|
+
},
|
|
174
|
+
// 1. pre-select some grid row indexes (less recommended, better use the Presets, see below)
|
|
175
|
+
// preselectedRows: [0, 2],
|
|
176
|
+
|
|
177
|
+
// 2. or use the Presets to pre-select some rows
|
|
178
|
+
presets: {
|
|
179
|
+
// you can presets row selection here as well, you can choose 1 of the following 2 ways of setting the selection
|
|
180
|
+
// by their index position in the grid (UI) or by the object IDs, the default is "dataContextIds" and if provided it will use it and disregard "gridRowIndexes"
|
|
181
|
+
// the RECOMMENDED is to use "dataContextIds" since that will always work even with Pagination, while "gridRowIndexes" is only good for 1 page
|
|
182
|
+
rowSelection: {
|
|
183
|
+
// gridRowIndexes: [2], // the row position of what you see on the screen (UI)
|
|
184
|
+
dataContextIds: [3, 12, 13, 522] // (recommended) select by your data object IDs
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
this.dataset1 = this.prepareData(495);
|
|
190
|
+
this.dataset2 = this.prepareData(525);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
prepareData(count: number) {
|
|
194
|
+
// mock a dataset
|
|
195
|
+
const mockDataset = [];
|
|
196
|
+
for (let i = 0; i < count; i++) {
|
|
197
|
+
const randomYear = 2000 + Math.floor(Math.random() * 10);
|
|
198
|
+
const randomMonth = Math.floor(Math.random() * 11);
|
|
199
|
+
const randomDay = Math.floor((Math.random() * 29));
|
|
200
|
+
const randomPercent = Math.round(Math.random() * 100);
|
|
201
|
+
|
|
202
|
+
mockDataset[i] = {
|
|
203
|
+
id: i,
|
|
204
|
+
title: 'Task ' + i,
|
|
205
|
+
duration: Math.round(Math.random() * 100) + '',
|
|
206
|
+
percentComplete: randomPercent,
|
|
207
|
+
percentCompleteNumber: randomPercent,
|
|
208
|
+
start: new Date(randomYear, randomMonth, randomDay),
|
|
209
|
+
finish: new Date(randomYear, (randomMonth + 1), randomDay),
|
|
210
|
+
effortDriven: (i % 5 === 0)
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
return mockDataset;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
goToGrid1FirstPage() {
|
|
217
|
+
this.angularGrid1.paginationService!.goToFirstPage();
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
goToGrid1LastPage() {
|
|
221
|
+
this.angularGrid1.paginationService!.goToLastPage();
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
goToGrid2FirstPage() {
|
|
225
|
+
this.angularGrid2.paginationService!.goToFirstPage();
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
goToGrid2LastPage() {
|
|
229
|
+
this.angularGrid2.paginationService!.goToLastPage();
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/** Dispatched event of a Grid State Changed event */
|
|
233
|
+
grid1StateChanged(gridStateChanges: GridStateChange) {
|
|
234
|
+
console.log('Grid State changed:: ', gridStateChanges);
|
|
235
|
+
console.log('Grid State changed:: ', gridStateChanges.change);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/** Dispatched event of a Grid State Changed event */
|
|
239
|
+
grid2StateChanged(gridStateChanges: GridStateChange) {
|
|
240
|
+
console.log('Grid State changed:: ', gridStateChanges);
|
|
241
|
+
console.log('Grid State changed:: ', gridStateChanges.change);
|
|
242
|
+
|
|
243
|
+
if (gridStateChanges!.gridState!.rowSelection) {
|
|
244
|
+
this.selectedGrid2IDs = (gridStateChanges!.gridState!.rowSelection.filteredDataContextIds || []) as number[];
|
|
245
|
+
this.selectedGrid2IDs = this.selectedGrid2IDs.sort((a, b) => a - b); // sort by ID
|
|
246
|
+
this.selectedTitles = this.selectedGrid2IDs.map(dataContextId => `Task ${dataContextId}`);
|
|
247
|
+
this.cd.detectChanges();
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
// Toggle the Pagination of Grid2
|
|
252
|
+
// IMPORTANT, the Pagination MUST BE CREATED on initial page load before you can start toggling it
|
|
253
|
+
// Basically you cannot toggle a Pagination that doesn't exist (must created at the time as the grid)
|
|
254
|
+
togglePaginationGrid2() {
|
|
255
|
+
this.isGrid2WithPagination = !this.isGrid2WithPagination;
|
|
256
|
+
this.angularGrid2.paginationService!.togglePaginationVisibility(this.isGrid2WithPagination);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
handleSelectedRowsChanged1(e: Event, args: any) {
|
|
260
|
+
if (Array.isArray(args.rows) && this.gridObj1) {
|
|
261
|
+
this.selectedTitle = args.rows.map((idx: number) => {
|
|
262
|
+
const item = this.gridObj1.getDataItem(idx);
|
|
263
|
+
return item.title || '';
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<div id="demo-container" class="container-fluid">
|
|
2
|
+
<h2>
|
|
3
|
+
{{title}}
|
|
4
|
+
<span class="float-end">
|
|
5
|
+
<a style="font-size: 18px"
|
|
6
|
+
target="_blank"
|
|
7
|
+
href="https://github.com/ghiscoding/Angular-Slickgrid/blob/master/src/app/examples/grid-state.component.ts">
|
|
8
|
+
<span class="fa fa-link"></span> code
|
|
9
|
+
</a>
|
|
10
|
+
</span>
|
|
11
|
+
</h2>
|
|
12
|
+
<div class="subtitle" [innerHTML]="subTitle"></div>
|
|
13
|
+
|
|
14
|
+
<button class="btn btn-outline-secondary btn-sm" data-test="reset-button" (click)="clearGridStateFromLocalStorage()">
|
|
15
|
+
<i class="fa fa-times"></i>
|
|
16
|
+
Clear Grid State from Local Storage & Reset Grid
|
|
17
|
+
</button>
|
|
18
|
+
|
|
19
|
+
<button class="btn btn-outline-secondary btn-sm" (click)="switchLanguage()" data-test="language-button">
|
|
20
|
+
<i class="fa fa-language"></i>
|
|
21
|
+
Switch Language
|
|
22
|
+
</button>
|
|
23
|
+
<b>Locale:</b>
|
|
24
|
+
<span style="font-style: italic" data-test="selected-locale">
|
|
25
|
+
{{selectedLanguage + '.json'}}
|
|
26
|
+
</span>
|
|
27
|
+
|
|
28
|
+
<angular-slickgrid gridId="grid16"
|
|
29
|
+
[columnDefinitions]="columnDefinitions"
|
|
30
|
+
[gridOptions]="gridOptions"
|
|
31
|
+
[dataset]="dataset"
|
|
32
|
+
(onAngularGridCreated)="angularGridReady($event.detail)"
|
|
33
|
+
(onGridStateChanged)="gridStateChanged($event.detail)"
|
|
34
|
+
(onBeforeGridDestroy)="saveCurrentGridState()">
|
|
35
|
+
</angular-slickgrid>
|
|
36
|
+
</div>
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
import { Component, OnDestroy, OnInit } from '@angular/core';
|
|
2
|
+
import { TranslateService } from '@ngx-translate/core';
|
|
3
|
+
import { Subscription } from 'rxjs';
|
|
4
|
+
import {
|
|
5
|
+
AngularGridInstance,
|
|
6
|
+
Column,
|
|
7
|
+
FieldType,
|
|
8
|
+
Filters,
|
|
9
|
+
Formatters,
|
|
10
|
+
GridOption,
|
|
11
|
+
GridState,
|
|
12
|
+
GridStateChange,
|
|
13
|
+
MultipleSelectOption,
|
|
14
|
+
unsubscribeAllObservables
|
|
15
|
+
} from './../modules/angular-slickgrid';
|
|
16
|
+
|
|
17
|
+
function randomBetween(min: number, max: number) {
|
|
18
|
+
return Math.floor(Math.random() * (max - min + 1) + min);
|
|
19
|
+
}
|
|
20
|
+
const DEFAULT_PAGE_SIZE = 25;
|
|
21
|
+
const LOCAL_STORAGE_KEY = 'gridState';
|
|
22
|
+
const NB_ITEMS = 500;
|
|
23
|
+
|
|
24
|
+
@Component({
|
|
25
|
+
templateUrl: './grid-state.component.html'
|
|
26
|
+
})
|
|
27
|
+
export class GridStateComponent implements OnInit, OnDestroy {
|
|
28
|
+
title = 'Example 16: Grid State & Presets using Local Storage';
|
|
29
|
+
subTitle = `
|
|
30
|
+
Grid State & Preset (<a href="https://github.com/ghiscoding/Angular-Slickgrid/wiki/Grid-State-&-Preset" target="_blank">Wiki docs</a>)
|
|
31
|
+
<br/>
|
|
32
|
+
<ul class="small">
|
|
33
|
+
<li>Uses Local Storage to persist the Grid State and uses Grid Options "presets" to put the grid back to it's previous state</li>
|
|
34
|
+
<ul>
|
|
35
|
+
<li>to demo this, simply change any columns (position reorder, visibility, size, filter, sort), then refresh your browser with (F5)</li>
|
|
36
|
+
</ul>
|
|
37
|
+
<li>Local Storage is just one option, you can use whichever is more convenient for you (Local Storage, Session Storage, DB, ...)</li>
|
|
38
|
+
</ul>
|
|
39
|
+
`;
|
|
40
|
+
private subscriptions: Subscription[] = [];
|
|
41
|
+
angularGrid!: AngularGridInstance;
|
|
42
|
+
columnDefinitions!: Column[];
|
|
43
|
+
gridOptions!: GridOption;
|
|
44
|
+
dataset!: any[];
|
|
45
|
+
selectedLanguage: string;
|
|
46
|
+
|
|
47
|
+
constructor(private translate: TranslateService) {
|
|
48
|
+
this.selectedLanguage = this.translate.getDefaultLang();
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
angularGridReady(angularGrid: AngularGridInstance) {
|
|
52
|
+
this.angularGrid = angularGrid;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
ngOnDestroy() {
|
|
56
|
+
// also unsubscribe all Angular Subscriptions
|
|
57
|
+
this.subscriptions = unsubscribeAllObservables(this.subscriptions);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
ngOnInit(): void {
|
|
61
|
+
const presets = JSON.parse(localStorage[LOCAL_STORAGE_KEY] || null);
|
|
62
|
+
|
|
63
|
+
// use some Grid State preset defaults if you wish or just restore from Locale Storage
|
|
64
|
+
// presets = presets || this.useDefaultPresets();
|
|
65
|
+
this.defineGrid(presets);
|
|
66
|
+
|
|
67
|
+
// always start with English for Cypress E2E tests to be consistent
|
|
68
|
+
const defaultLang = 'en';
|
|
69
|
+
this.translate.use(defaultLang);
|
|
70
|
+
this.selectedLanguage = defaultLang;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** Clear the Grid State from Local Storage and reset the grid to it's original state */
|
|
74
|
+
clearGridStateFromLocalStorage() {
|
|
75
|
+
localStorage[LOCAL_STORAGE_KEY] = null;
|
|
76
|
+
this.angularGrid.gridService.resetGrid(this.columnDefinitions);
|
|
77
|
+
this.angularGrid.paginationService!.changeItemPerPage(DEFAULT_PAGE_SIZE);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/* Define grid Options and Columns */
|
|
81
|
+
defineGrid(gridStatePresets?: GridState) {
|
|
82
|
+
// prepare a multiple-select array to filter with
|
|
83
|
+
const multiSelectFilterArray = [];
|
|
84
|
+
for (let i = 0; i < NB_ITEMS; i++) {
|
|
85
|
+
multiSelectFilterArray.push({ value: i, label: i });
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
this.columnDefinitions = [
|
|
89
|
+
{
|
|
90
|
+
id: 'title',
|
|
91
|
+
name: 'Title',
|
|
92
|
+
field: 'title',
|
|
93
|
+
nameKey: 'TITLE',
|
|
94
|
+
filterable: true,
|
|
95
|
+
sortable: true,
|
|
96
|
+
type: FieldType.string,
|
|
97
|
+
minWidth: 45, width: 100,
|
|
98
|
+
filter: {
|
|
99
|
+
model: Filters.compoundInput
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
id: 'description', name: 'Description', field: 'description', filterable: true, sortable: true, minWidth: 80, width: 100,
|
|
104
|
+
type: FieldType.string,
|
|
105
|
+
filter: {
|
|
106
|
+
model: Filters.input
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
id: 'duration', name: 'Duration (days)', field: 'duration', sortable: true, type: FieldType.number, exportCsvForceToKeepAsString: true,
|
|
111
|
+
minWidth: 55, width: 100,
|
|
112
|
+
nameKey: 'DURATION',
|
|
113
|
+
filterable: true,
|
|
114
|
+
filter: {
|
|
115
|
+
collection: multiSelectFilterArray,
|
|
116
|
+
model: Filters.multipleSelect,
|
|
117
|
+
// we could add certain option(s) to the "multiple-select" plugin
|
|
118
|
+
filterOptions: {
|
|
119
|
+
maxHeight: 250,
|
|
120
|
+
width: 175
|
|
121
|
+
} as MultipleSelectOption
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
id: 'complete', name: '% Complete', field: 'percentComplete', nameKey: 'PERCENT_COMPLETE', minWidth: 70, type: FieldType.number, sortable: true, width: 100,
|
|
126
|
+
formatter: Formatters.percentCompleteBar, filterable: true, filter: { model: Filters.slider, operator: '>' }
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
id: 'start', name: 'Start', field: 'start', nameKey: 'START', formatter: Formatters.dateIso, sortable: true, minWidth: 75, exportWithFormatter: true, width: 100,
|
|
130
|
+
type: FieldType.date, filterable: true, filter: { model: Filters.compoundDate }
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
id: 'completed', field: 'completed', nameKey: 'COMPLETED', minWidth: 85, maxWidth: 85, formatter: Formatters.checkmark, width: 100,
|
|
134
|
+
type: FieldType.boolean,
|
|
135
|
+
sortable: true,
|
|
136
|
+
filterable: true,
|
|
137
|
+
filter: {
|
|
138
|
+
collection: [{ value: '', label: '' }, { value: true, label: 'True' }, { value: false, label: 'False' }],
|
|
139
|
+
model: Filters.singleSelect,
|
|
140
|
+
|
|
141
|
+
// we could add certain option(s) to the "multiple-select" plugin
|
|
142
|
+
filterOptions: { autoDropWidth: true } as MultipleSelectOption,
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
];
|
|
146
|
+
|
|
147
|
+
this.gridOptions = {
|
|
148
|
+
autoResize: {
|
|
149
|
+
container: '#demo-container',
|
|
150
|
+
rightPadding: 10
|
|
151
|
+
},
|
|
152
|
+
enableCheckboxSelector: true,
|
|
153
|
+
enableFiltering: true,
|
|
154
|
+
enableTranslate: true,
|
|
155
|
+
i18n: this.translate,
|
|
156
|
+
columnPicker: {
|
|
157
|
+
hideForceFitButton: true
|
|
158
|
+
},
|
|
159
|
+
gridMenu: {
|
|
160
|
+
hideForceFitButton: true,
|
|
161
|
+
hideClearFrozenColumnsCommand: false,
|
|
162
|
+
},
|
|
163
|
+
headerMenu: {
|
|
164
|
+
hideFreezeColumnsCommand: false,
|
|
165
|
+
},
|
|
166
|
+
enablePagination: true,
|
|
167
|
+
pagination: {
|
|
168
|
+
pageSizes: [5, 10, 15, 20, 25, 30, 40, 50, 75, 100],
|
|
169
|
+
pageSize: DEFAULT_PAGE_SIZE
|
|
170
|
+
},
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
// reload the Grid State with the grid options presets
|
|
174
|
+
if (gridStatePresets) {
|
|
175
|
+
this.gridOptions.presets = gridStatePresets;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
this.dataset = this.getData(NB_ITEMS);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
getData(count: number) {
|
|
182
|
+
// mock a dataset
|
|
183
|
+
const tmpData = [];
|
|
184
|
+
for (let i = 0; i < count; i++) {
|
|
185
|
+
const randomDuration = Math.round(Math.random() * 100);
|
|
186
|
+
const randomYear = randomBetween(2000, 2025);
|
|
187
|
+
const randomYearShort = randomBetween(10, 25);
|
|
188
|
+
const randomMonth = randomBetween(1, 12);
|
|
189
|
+
const randomMonthStr = (randomMonth < 10) ? `0${randomMonth}` : randomMonth;
|
|
190
|
+
const randomDay = randomBetween(10, 28);
|
|
191
|
+
const randomPercent = randomBetween(0, 100);
|
|
192
|
+
const randomHour = randomBetween(10, 23);
|
|
193
|
+
const randomTime = randomBetween(10, 59);
|
|
194
|
+
|
|
195
|
+
tmpData[i] = {
|
|
196
|
+
id: i,
|
|
197
|
+
title: 'Task ' + i,
|
|
198
|
+
etc: 'Something hidden ' + i,
|
|
199
|
+
description: (i % 5) ? 'desc ' + i : null, // also add some random to test NULL field
|
|
200
|
+
duration: randomDuration,
|
|
201
|
+
percentComplete: randomPercent,
|
|
202
|
+
percentCompleteNumber: randomPercent,
|
|
203
|
+
start: new Date(randomYear, randomMonth, randomDay), // provide a Date format
|
|
204
|
+
usDateShort: `${randomMonth}/${randomDay}/${randomYearShort}`, // provide a date US Short in the dataset
|
|
205
|
+
utcDate: `${randomYear}-${randomMonthStr}-${randomDay}T${randomHour}:${randomTime}:${randomTime}Z`,
|
|
206
|
+
completed: (i % 3 === 0)
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
return tmpData;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/** Dispatched event of a Grid State Changed event */
|
|
213
|
+
gridStateChanged(gridStateChanges: GridStateChange) {
|
|
214
|
+
console.log('Client sample, Grid State changed:: ', gridStateChanges);
|
|
215
|
+
localStorage[LOCAL_STORAGE_KEY] = JSON.stringify(gridStateChanges.gridState);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/** Save current Filters, Sorters in LocaleStorage or DB */
|
|
219
|
+
saveCurrentGridState() {
|
|
220
|
+
const gridState: GridState = this.angularGrid.gridStateService.getCurrentGridState();
|
|
221
|
+
console.log('Client sample, last Grid State:: ', gridState);
|
|
222
|
+
localStorage[LOCAL_STORAGE_KEY] = JSON.stringify(gridState);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
switchLanguage() {
|
|
226
|
+
const nextLanguage = (this.selectedLanguage === 'en') ? 'fr' : 'en';
|
|
227
|
+
this.subscriptions.push(
|
|
228
|
+
this.translate.use(nextLanguage).subscribe(() => {
|
|
229
|
+
this.selectedLanguage = nextLanguage;
|
|
230
|
+
})
|
|
231
|
+
);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
useDefaultPresets() {
|
|
235
|
+
// use columnDef searchTerms OR use presets as shown below
|
|
236
|
+
return {
|
|
237
|
+
columns: [
|
|
238
|
+
{ columnId: 'description', width: 170 }, // flip column position of Title/Description to Description/Title
|
|
239
|
+
{ columnId: 'title', width: 55 },
|
|
240
|
+
{ columnId: 'duration' },
|
|
241
|
+
{ columnId: 'complete' },
|
|
242
|
+
{ columnId: 'start' },
|
|
243
|
+
{ columnId: 'usDateShort' },
|
|
244
|
+
{ columnId: 'utcDate' },
|
|
245
|
+
// { columnId: 'completed' }, // to HIDE a column, simply ommit it from the preset array
|
|
246
|
+
],
|
|
247
|
+
filters: [
|
|
248
|
+
{ columnId: 'duration', searchTerms: [2, 22, 44] },
|
|
249
|
+
// { columnId: 'complete', searchTerms: ['5'], operator: '>' },
|
|
250
|
+
{ columnId: 'usDateShort', operator: '<', searchTerms: ['4/20/25'] },
|
|
251
|
+
// { columnId: 'completed', searchTerms: [true] }
|
|
252
|
+
],
|
|
253
|
+
sorters: [
|
|
254
|
+
{ columnId: 'duration', direction: 'DESC' },
|
|
255
|
+
{ columnId: 'complete', direction: 'ASC' }
|
|
256
|
+
],
|
|
257
|
+
} as GridState;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<div class="container-fluid">
|
|
2
|
+
<h2>
|
|
3
|
+
{{title}}
|
|
4
|
+
<span class="float-end">
|
|
5
|
+
<a style="font-size: 18px"
|
|
6
|
+
target="_blank"
|
|
7
|
+
href="https://github.com/ghiscoding/Angular-Slickgrid/blob/master/src/app/examples/grid-tabs.component.ts">
|
|
8
|
+
<span class="fa fa-link"></span> code
|
|
9
|
+
</a>
|
|
10
|
+
</span>
|
|
11
|
+
</h2>
|
|
12
|
+
<div class="subtitle" [innerHTML]="subTitle"></div>
|
|
13
|
+
|
|
14
|
+
<div>
|
|
15
|
+
<tabset>
|
|
16
|
+
<tab heading="Javascript" id="javascript" data-test="javascript-tab">
|
|
17
|
+
<h4>Grid 1 - Load Local Data</h4>
|
|
18
|
+
<angular-slickgrid gridId="grid1"
|
|
19
|
+
[columnDefinitions]="columnDefinitions1"
|
|
20
|
+
[gridOptions]="gridOptions1"
|
|
21
|
+
[dataset]="dataset1">
|
|
22
|
+
</angular-slickgrid>
|
|
23
|
+
</tab>
|
|
24
|
+
<tab heading="Http-Client" data-test="http-tab" (selectTab)="resizeGrid2()">
|
|
25
|
+
<h4>Grid 2 - Load a JSON dataset through Http-Client</h4>
|
|
26
|
+
<angular-slickgrid gridId="grid2"
|
|
27
|
+
[columnDefinitions]="columnDefinitions2"
|
|
28
|
+
[gridOptions]="gridOptions2"
|
|
29
|
+
[dataset]="dataset2"
|
|
30
|
+
(onAngularGridCreated)="angularGrid2Ready($event.detail)">
|
|
31
|
+
</angular-slickgrid>
|
|
32
|
+
</tab>
|
|
33
|
+
</tabset>
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|