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,30 @@
|
|
|
1
|
+
<div class="container-fluid" style="margin-top: 10px">
|
|
2
|
+
<h2>
|
|
3
|
+
<span [innerHTML]="title"></span>
|
|
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/swt-common-grid-test.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 class="row">
|
|
15
|
+
<div class="col-sm-8">
|
|
16
|
+
<div class="alert alert-info">
|
|
17
|
+
<strong>Custom Pagination URL:</strong>
|
|
18
|
+
<div [innerHTML]="currentUrl" data-test="query-string"></div>
|
|
19
|
+
</div>
|
|
20
|
+
</div>
|
|
21
|
+
<div class="col-sm-4">
|
|
22
|
+
<swt-common-grid-pagination #commonGridPag1></swt-common-grid-pagination>
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
<swt-common-grid #commonGrid1
|
|
26
|
+
(onFilterChanged)="filterChanged($event.detail)"
|
|
27
|
+
(onPaginationChanged)="paginationChanged($event.detail)"
|
|
28
|
+
(onSortChanged)="sortChanged($event.detail)">
|
|
29
|
+
</swt-common-grid>
|
|
30
|
+
</div>
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AfterViewInit,
|
|
3
|
+
Component,
|
|
4
|
+
ComponentFactoryResolver,
|
|
5
|
+
OnInit,
|
|
6
|
+
ViewChild,
|
|
7
|
+
ViewContainerRef,
|
|
8
|
+
} from '@angular/core';
|
|
9
|
+
import { HttpClient } from '@angular/common/http';
|
|
10
|
+
|
|
11
|
+
import { SwtCommonGridComponent } from './swt-common-grid.component';
|
|
12
|
+
import { SwtCommonGridPaginationComponent } from './swt-common-grid-pagination.component';
|
|
13
|
+
import { FilterChangedArgs, PaginationChangedArgs } from '../modules/angular-slickgrid';
|
|
14
|
+
|
|
15
|
+
import { Logger } from './swt-logger.service';
|
|
16
|
+
/**
|
|
17
|
+
* Main test Component
|
|
18
|
+
*
|
|
19
|
+
* @author Saber Chebka, saber.chebka@gmail.com
|
|
20
|
+
*/
|
|
21
|
+
@Component({
|
|
22
|
+
selector: 'swt-common-grid-test',
|
|
23
|
+
templateUrl: './swt-common-grid-test.component.html'
|
|
24
|
+
})
|
|
25
|
+
export class SwtCommonGridTestComponent implements OnInit, AfterViewInit {
|
|
26
|
+
title = 'Example 13: Custom Backend Server Pagination';
|
|
27
|
+
subTitle = `A simple component to show that it is possible to create a custom Backend Service for any other backend querying, the example below is for Oracle.`;
|
|
28
|
+
componentFactory: any;
|
|
29
|
+
testurl = 'http://127.0.0.1:8080/grid!display.do?';
|
|
30
|
+
currentUrl = this.testurl;
|
|
31
|
+
|
|
32
|
+
@ViewChild('commonGrid1', { static: true }) commonGrid!: SwtCommonGridComponent;
|
|
33
|
+
@ViewChild('commonGridPag1', { static: true }) commonGridPag!: SwtCommonGridPaginationComponent;
|
|
34
|
+
|
|
35
|
+
private logger: Logger;
|
|
36
|
+
|
|
37
|
+
constructor(private httpClient: HttpClient,
|
|
38
|
+
private viewContainerRef: ViewContainerRef,
|
|
39
|
+
private componentFactoryResolver: ComponentFactoryResolver) {
|
|
40
|
+
this.logger = new Logger('test', undefined);
|
|
41
|
+
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
ngOnInit() {
|
|
45
|
+
// Link pagination component into the current Grid
|
|
46
|
+
if (this.commonGridPag) {
|
|
47
|
+
this.commonGrid.paginationComponent = this.commonGridPag;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
ngAfterViewInit() {
|
|
53
|
+
this.logger.info('method [ngAfterViewInit] - START');
|
|
54
|
+
|
|
55
|
+
setTimeout(() => {
|
|
56
|
+
// Init datagrid example:
|
|
57
|
+
this.commonGridPag.processing = true;
|
|
58
|
+
|
|
59
|
+
// Real HTTP call
|
|
60
|
+
this.currentUrl = this.testurl + '¤tPage=1';
|
|
61
|
+
/*
|
|
62
|
+
this.httpClient.get(this.currentUrl).subscribe(
|
|
63
|
+
(data: any) => {
|
|
64
|
+
this.commonGrid.CustomGrid(data.suspectManagement.grid.metadata);
|
|
65
|
+
this.commonGrid.gridData = data.suspectManagement.grid.rows;
|
|
66
|
+
this.commonGridPag.pageCount = data.suspectManagement.singletons.maxpage;
|
|
67
|
+
this.commonGridPag.processing = false;
|
|
68
|
+
}
|
|
69
|
+
);
|
|
70
|
+
*/
|
|
71
|
+
this.commonGrid.CustomGrid(data_sample.pagination_samples.grid.metadata);
|
|
72
|
+
this.commonGrid.gridData = data_sample.pagination_samples.grid.rows;
|
|
73
|
+
this.commonGridPag.pageCount = data_sample.pagination_samples.grid.rows.maxpage;
|
|
74
|
+
|
|
75
|
+
this.commonGridPag.processing = false;
|
|
76
|
+
}, 0);
|
|
77
|
+
this.logger.info('method [ngAfterViewInit] - END');
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
filterChanged(event: FilterChangedArgs) {
|
|
81
|
+
this.commonGridPag.processing = true;
|
|
82
|
+
this.updateGridData();
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
paginationChanged(event: PaginationChangedArgs) {
|
|
86
|
+
this.commonGridPag.processing = true;
|
|
87
|
+
this.updateGridData();
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
sortChanged(event: any) {
|
|
91
|
+
this.commonGridPag.processing = true;
|
|
92
|
+
this.updateGridData();
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
updateGridData() {
|
|
97
|
+
this.currentUrl = this.testurl + '¤tPage=' + this.commonGrid.currentPage + '&selectedSort=' + this.commonGrid.sortedGridColumn + '&selectedFilter=' + this.commonGrid.filteredGridColumns;
|
|
98
|
+
// Real HTTP call
|
|
99
|
+
/*this.httpClient.get(this.currentUrl).subscribe(
|
|
100
|
+
(data: any) => {
|
|
101
|
+
this.commonGrid.gridData = data.suspectManagement?data.suspectManagement.grid.rows:[];
|
|
102
|
+
this.commonGridPag.pageCount = data.suspectManagement?data.suspectManagement.singletons.maxpage:1;
|
|
103
|
+
this.commonGridPag.processing = false;
|
|
104
|
+
}
|
|
105
|
+
);*/
|
|
106
|
+
setTimeout(() => {
|
|
107
|
+
this.commonGrid.gridData = data_sample.pagination_samples.grid.rows;
|
|
108
|
+
this.commonGridPag.pageCount = data_sample.pagination_samples.grid.rows.maxpage;
|
|
109
|
+
}, 750);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
export const data_sample = {
|
|
115
|
+
'pagination_samples': {
|
|
116
|
+
'grid': {
|
|
117
|
+
'metadata': {
|
|
118
|
+
'columns': {
|
|
119
|
+
'column': [{
|
|
120
|
+
'sort': true,
|
|
121
|
+
'filterable': false,
|
|
122
|
+
'width': 60,
|
|
123
|
+
'dataelement': 'hasNote',
|
|
124
|
+
'heading': 'Note'
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
'sort': true,
|
|
128
|
+
'filterable': true,
|
|
129
|
+
'width': 125,
|
|
130
|
+
'dataelement': 'status',
|
|
131
|
+
'heading': 'Status'
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
'sort': true,
|
|
135
|
+
'visible': true,
|
|
136
|
+
'filterable': true,
|
|
137
|
+
'width': 125,
|
|
138
|
+
'dataelement': 'currency',
|
|
139
|
+
'heading': 'Currency'
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
'sort': true,
|
|
143
|
+
'visible': true,
|
|
144
|
+
'filterable': true,
|
|
145
|
+
'width': 125,
|
|
146
|
+
'dataelement': 'amount',
|
|
147
|
+
'heading': 'Amount'
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
'sort': true,
|
|
151
|
+
'visible': true,
|
|
152
|
+
'filterable': true,
|
|
153
|
+
'width': 125,
|
|
154
|
+
'dataelement': 'inputDate',
|
|
155
|
+
'heading': 'Input Date'
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
'sort': true,
|
|
159
|
+
'visible': true,
|
|
160
|
+
'filterable': true,
|
|
161
|
+
'width': 125,
|
|
162
|
+
'dataelement': 'inputTime',
|
|
163
|
+
'heading': 'Input Time'
|
|
164
|
+
}]
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
'rows': {
|
|
168
|
+
'row': [{
|
|
169
|
+
'currency': {
|
|
170
|
+
'content': 'EUR'
|
|
171
|
+
},
|
|
172
|
+
'amount': {
|
|
173
|
+
'content': '2 203 677,000'
|
|
174
|
+
},
|
|
175
|
+
'startTime': {
|
|
176
|
+
'content': '06/19/2017 11:52:51'
|
|
177
|
+
},
|
|
178
|
+
'inputDate': {
|
|
179
|
+
'content': '06/19/2017'
|
|
180
|
+
},
|
|
181
|
+
'status': {
|
|
182
|
+
'content': 'New'
|
|
183
|
+
},
|
|
184
|
+
'inputTime': {
|
|
185
|
+
'content': '11:52:51'
|
|
186
|
+
},
|
|
187
|
+
'hasNote': {
|
|
188
|
+
'content': 'False'
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
'currency': {
|
|
193
|
+
'content': 'USD'
|
|
194
|
+
},
|
|
195
|
+
'amount': {
|
|
196
|
+
'content': '6 203 677,000'
|
|
197
|
+
},
|
|
198
|
+
'startTime': {
|
|
199
|
+
'content': '06/28/2017 10:42:00'
|
|
200
|
+
},
|
|
201
|
+
'inputDate': {
|
|
202
|
+
'content': '06/28/2017'
|
|
203
|
+
},
|
|
204
|
+
'status': {
|
|
205
|
+
'content': 'New'
|
|
206
|
+
},
|
|
207
|
+
'inputTime': {
|
|
208
|
+
'content': '10:40:12'
|
|
209
|
+
},
|
|
210
|
+
'hasNote': {
|
|
211
|
+
'content': 'True'
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
],
|
|
215
|
+
'maxpage': 5
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
};
|
|
@@ -0,0 +1,436 @@
|
|
|
1
|
+
import { Component, OnInit, AfterViewInit, Input, EventEmitter, Output, ViewChild, ElementRef, Renderer2 } from '@angular/core';
|
|
2
|
+
import { HttpClient } from '@angular/common/http';
|
|
3
|
+
import {
|
|
4
|
+
AngularGridInstance,
|
|
5
|
+
AngularSlickgridComponent, Column, FieldType,
|
|
6
|
+
GridOption, BackendService,
|
|
7
|
+
BackendServiceOption, FilterChangedArgs, PaginationChangedArgs, Pagination, SlickGrid, SlickDataView
|
|
8
|
+
} from '../modules/angular-slickgrid';
|
|
9
|
+
import { TranslateService } from '@ngx-translate/core';
|
|
10
|
+
import { Logger } from './swt-logger.service';
|
|
11
|
+
import { SwtCommonGridPaginationComponent } from './swt-common-grid-pagination.component';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Custom wrapper of angular-slickgrid components, allows easily interacting with SwtCommonGridPaginationComponent
|
|
15
|
+
*
|
|
16
|
+
* @author Saber Chebka, saber.chebka@gmail.com
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
let timer: any;
|
|
20
|
+
const DEFAULT_FILTER_TYPING_DEBOUNCE = 750;
|
|
21
|
+
|
|
22
|
+
@Component({
|
|
23
|
+
selector: 'swt-common-grid',
|
|
24
|
+
template: `<angular-slickgrid gridId='common-grid'
|
|
25
|
+
#angularSlickGrid
|
|
26
|
+
(onAngularGridCreated)="gridReady($event.detail)"
|
|
27
|
+
[columnDefinitions]="columnDefinitions"
|
|
28
|
+
[gridOptions]="gridOptions"
|
|
29
|
+
[dataset]="dataset">
|
|
30
|
+
</angular-slickgrid>`,
|
|
31
|
+
styles: [`
|
|
32
|
+
:host ::ng-deep .gridPane{
|
|
33
|
+
width: 100%!important;
|
|
34
|
+
}
|
|
35
|
+
:host ::ng-deep .slickgrid-container{
|
|
36
|
+
width: 100%!important;
|
|
37
|
+
}
|
|
38
|
+
`]
|
|
39
|
+
})
|
|
40
|
+
export class SwtCommonGridComponent implements OnInit, AfterViewInit, BackendService {
|
|
41
|
+
|
|
42
|
+
private logger: Logger;
|
|
43
|
+
private defaultPageSize = 20;
|
|
44
|
+
|
|
45
|
+
@Input() gridHeight = 100;
|
|
46
|
+
@Input() gridWidth = 600;
|
|
47
|
+
|
|
48
|
+
gridHeightString!: string;
|
|
49
|
+
gridWidthString!: string;
|
|
50
|
+
|
|
51
|
+
@ViewChild('angularSlickGrid', { static: true }) angularSlickGrid!: AngularSlickgridComponent;
|
|
52
|
+
|
|
53
|
+
columnDefinitions: Column[] = [];
|
|
54
|
+
dataset!: any[];
|
|
55
|
+
gridObj: any;
|
|
56
|
+
dataviewObj: any;
|
|
57
|
+
isAutoEdit = false;
|
|
58
|
+
updatedObject: any;
|
|
59
|
+
isMultiSelect = true;
|
|
60
|
+
selectedObjects!: any[];
|
|
61
|
+
selectedObject: any;
|
|
62
|
+
|
|
63
|
+
// Slick grid
|
|
64
|
+
metaData: any;
|
|
65
|
+
columnData: any;
|
|
66
|
+
rowsData: any;
|
|
67
|
+
selects: any;
|
|
68
|
+
id: any;
|
|
69
|
+
|
|
70
|
+
options!: BackendServiceOption;
|
|
71
|
+
pagination?: Pagination;
|
|
72
|
+
|
|
73
|
+
@Output() onFilterChanged: EventEmitter<FilterChangedArgs> = new EventEmitter<FilterChangedArgs>();
|
|
74
|
+
@Output() onPaginationChanged: EventEmitter<PaginationChangedArgs> = new EventEmitter<PaginationChangedArgs>();
|
|
75
|
+
@Output() onSortChanged: EventEmitter<any> = new EventEmitter<any>();
|
|
76
|
+
|
|
77
|
+
sortedGridColumn = '';
|
|
78
|
+
currentPage = 1;
|
|
79
|
+
filteredGridColumns = '';
|
|
80
|
+
|
|
81
|
+
// Data
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
// Injected functions
|
|
85
|
+
private _onRowDoubleClick: Function = new Function();
|
|
86
|
+
private _onRowClick: Function = new Function();
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
private _selectedRow: any;
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
gridOptions: GridOption = {
|
|
93
|
+
asyncEditorLoading: false,
|
|
94
|
+
autoEdit: this.isAutoEdit,
|
|
95
|
+
autoResize: {
|
|
96
|
+
container: '#common-grid-container',
|
|
97
|
+
rightPadding: 10
|
|
98
|
+
},
|
|
99
|
+
gridHeight: 200,
|
|
100
|
+
enableColumnPicker: true,
|
|
101
|
+
enableCellNavigation: true,
|
|
102
|
+
enableRowSelection: true,
|
|
103
|
+
enableCheckboxSelector: false,
|
|
104
|
+
enableFiltering: true,
|
|
105
|
+
rowHeight: 23,
|
|
106
|
+
forceFitColumns: true,
|
|
107
|
+
enableAutoTooltip: true,
|
|
108
|
+
enableGridMenu: true,
|
|
109
|
+
enablePagination: false
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
// Initialized to a fake pagination object
|
|
113
|
+
private _paginationComponent: any = {
|
|
114
|
+
processing: false,
|
|
115
|
+
realPagination: false
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
@Input()
|
|
119
|
+
set paginationComponent(value: SwtCommonGridPaginationComponent) {
|
|
120
|
+
this.logger!.info('method [pagination] - START, assigned datagrid pagination object: ', value.realPagination);
|
|
121
|
+
if (value.realPagination) {
|
|
122
|
+
this._paginationComponent = value;
|
|
123
|
+
this.gridOptions.backendServiceApi = {
|
|
124
|
+
service: this,
|
|
125
|
+
preProcess: () => { },
|
|
126
|
+
process: () => {
|
|
127
|
+
return null;
|
|
128
|
+
},
|
|
129
|
+
postProcess: () => { }
|
|
130
|
+
} as any;
|
|
131
|
+
this._paginationComponent.gridPaginationOptions = this.gridOptions;
|
|
132
|
+
this.angularSlickGrid.createBackendApiInternalPostProcessCallback(this.gridOptions);
|
|
133
|
+
}
|
|
134
|
+
this.logger!.info('method [pagination] - START');
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
get paginationComponent(): SwtCommonGridPaginationComponent {
|
|
138
|
+
return this._paginationComponent;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
*
|
|
143
|
+
* @param gridService
|
|
144
|
+
* @param resizer
|
|
145
|
+
* @param httpClient
|
|
146
|
+
*/
|
|
147
|
+
constructor(private httpClient: HttpClient, private translate: TranslateService,
|
|
148
|
+
private el: ElementRef, private renderer: Renderer2) {
|
|
149
|
+
this.logger = new Logger('grid', httpClient);
|
|
150
|
+
|
|
151
|
+
this.logger.info('method [constructor] - START/END');
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
*
|
|
158
|
+
*/
|
|
159
|
+
ngOnInit() {
|
|
160
|
+
this.logger.info('method [ngOnInit] - START/END');
|
|
161
|
+
// this.gridHeightString = `${this.gridHeight}px`;
|
|
162
|
+
// this.gridWidthString = `${this.gridWidth}px`;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
*
|
|
168
|
+
*/
|
|
169
|
+
ngAfterViewInit() {
|
|
170
|
+
this.logger.info('method [ngAfterViewInit] - START/END');
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* CustomGrid constructor
|
|
175
|
+
* @param columnData
|
|
176
|
+
*/
|
|
177
|
+
CustomGrid(columnData: any) {
|
|
178
|
+
this.logger.info('method [CustomGrid] - START');
|
|
179
|
+
|
|
180
|
+
this.id = 'grid' + Math.floor(Math.random() * Math.floor(100));
|
|
181
|
+
|
|
182
|
+
// get metadata from input JSON
|
|
183
|
+
this.metaData = columnData;
|
|
184
|
+
|
|
185
|
+
// COLUMNS DATA
|
|
186
|
+
const rowData: any = [];
|
|
187
|
+
|
|
188
|
+
// check if allcolumns tag contains any children
|
|
189
|
+
if (this.metaData.columns.column) {
|
|
190
|
+
|
|
191
|
+
// set columnsData and columnDefinitions
|
|
192
|
+
this.columnData = this.metaData.columns.column;
|
|
193
|
+
|
|
194
|
+
for (let index = 0; index < this.columnData.length; index++) {
|
|
195
|
+
|
|
196
|
+
const type = FieldType.string;
|
|
197
|
+
const editor = null;
|
|
198
|
+
const formatter = null;
|
|
199
|
+
const filter = null;
|
|
200
|
+
const outputType = null;
|
|
201
|
+
const params = null;
|
|
202
|
+
|
|
203
|
+
const col: any = {
|
|
204
|
+
id: this.columnData[index].dataelement,
|
|
205
|
+
name: this.columnData[index].heading,
|
|
206
|
+
field: this.columnData[index].dataelement,
|
|
207
|
+
sortable: this.columnData[index].sort,
|
|
208
|
+
filterable: this.columnData[index].filterable,
|
|
209
|
+
type,
|
|
210
|
+
editor,
|
|
211
|
+
formatter,
|
|
212
|
+
filter,
|
|
213
|
+
outputType,
|
|
214
|
+
params,
|
|
215
|
+
width: this.columnData[index].width
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
this.columnDefinitions.push(col);
|
|
219
|
+
rowData[col.id] = '';
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
// Columns are not visible, seems to be a bug ? next line fixed it..
|
|
223
|
+
this.gridObj.setColumns(this.columnDefinitions);
|
|
224
|
+
this.angularSlickGrid.showPagination = false;
|
|
225
|
+
|
|
226
|
+
// Show filters when grid starts; this could be parametrized
|
|
227
|
+
// this.gridObj.setHeaderRowVisibility(false);
|
|
228
|
+
// this.gridObj.setTopPanelVisibility(false);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
// Dummy dataset
|
|
232
|
+
this.dataset = rowData;
|
|
233
|
+
|
|
234
|
+
this.logger.info('method [CustomGrid] - END, this.columnDefinitions=', this.columnDefinitions);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* CommonGrid constructor
|
|
239
|
+
* @param columnsData
|
|
240
|
+
* @param lockedColumnCount
|
|
241
|
+
* @param uniqueColumn
|
|
242
|
+
* @param baseURL
|
|
243
|
+
* @param programId
|
|
244
|
+
* @param componentId
|
|
245
|
+
* @param enableRenders
|
|
246
|
+
* @param colValidationMap
|
|
247
|
+
* @param checkHeader
|
|
248
|
+
* @param cboLinked
|
|
249
|
+
*/
|
|
250
|
+
CommonGrid(columnsData: any, lockedColumnCount: number, uniqueColumn: string, baseURL: string, programId: string, componentId: string, enableRenders: boolean = true, colValidationMap: any = null, checkHeader: boolean = false, cboLinked: boolean = false) {
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
set gridData(rawData: any) {
|
|
255
|
+
this.logger.info('method [gridData] - START');
|
|
256
|
+
const dataProvider: any = [];
|
|
257
|
+
|
|
258
|
+
for (let index = 0; rawData.row && index < rawData.row.length; index++) {
|
|
259
|
+
const row = <Object>rawData.row[index];
|
|
260
|
+
const idObj = {
|
|
261
|
+
id: index
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
let key: string;
|
|
265
|
+
const rowData: any = [];
|
|
266
|
+
for (key in row) {
|
|
267
|
+
if (row.hasOwnProperty(key)) {
|
|
268
|
+
rowData[key] = (row as any)[key].content;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
dataProvider[index] = Object.assign(rowData, idObj);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
this.dataset = dataProvider;
|
|
275
|
+
this.paginationComponent.processing = false;
|
|
276
|
+
this.logger.info('method [gridData] - END, all data size=' + (rawData && rawData.hasOwnProperty('size') ? rawData.size : 0));
|
|
277
|
+
|
|
278
|
+
// this.gridObj.setSortColumn('excludeType', true);
|
|
279
|
+
// this.dataviewObj.reSort();
|
|
280
|
+
// this.gridObj.setSortColumns([{'columnId':'excludeType','sortAsc':true}]);
|
|
281
|
+
|
|
282
|
+
// this.gridObj.invalidate();
|
|
283
|
+
// this.gridObj.render();
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
get gridData(): any {
|
|
287
|
+
return this.dataset;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
gridReady(instance: AngularGridInstance) {
|
|
291
|
+
this.logger.info('method [gridReady] - START');
|
|
292
|
+
this.gridObj = instance.slickGrid;
|
|
293
|
+
this.dataviewObj = instance.dataView;
|
|
294
|
+
this.logger.info('method [gridReady] - END');
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
dataviewReady(dataview: SlickDataView) {
|
|
298
|
+
this.logger.info('method [dataviewReady] - START/END', dataview);
|
|
299
|
+
this.dataviewObj = dataview;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
/********************************************************/
|
|
306
|
+
/******** Pagination+Sot+Filter service : START *********/
|
|
307
|
+
/********************************************************/
|
|
308
|
+
buildQuery(): string {
|
|
309
|
+
return 'buildQuery...';
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
init(serviceOptions: BackendServiceOption, pagination?: Pagination): void {
|
|
313
|
+
this.options = serviceOptions;
|
|
314
|
+
this.pagination = pagination;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
resetPaginationOptions() {
|
|
319
|
+
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
updateOptions(serviceOptions?: Partial<BackendServiceOption>) {
|
|
323
|
+
this.options = { ...this.options, ...serviceOptions };
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* FILTERING EMIT EVENT
|
|
329
|
+
* @param event
|
|
330
|
+
* @param args
|
|
331
|
+
*/
|
|
332
|
+
processOnFilterChanged(event: Event | undefined, args: FilterChangedArgs): string {
|
|
333
|
+
this.logger.info('method [onFilterChanged] - START', args);
|
|
334
|
+
this.filteredGridColumns = '';
|
|
335
|
+
let timing = 0;
|
|
336
|
+
if (event && (event.type === 'keyup' || event.type === 'keydown')) {
|
|
337
|
+
timing = DEFAULT_FILTER_TYPING_DEBOUNCE;
|
|
338
|
+
clearTimeout(timer);
|
|
339
|
+
}
|
|
340
|
+
timer = setTimeout(() => {
|
|
341
|
+
this.filteredGridColumns = '';
|
|
342
|
+
for (let idx = 0; idx < this.columnDefinitions.length; idx++) {
|
|
343
|
+
if (args.columnFilters.hasOwnProperty(this.columnDefinitions[idx].field)) {
|
|
344
|
+
this.filteredGridColumns += args.columnFilters[this.columnDefinitions[idx].field].searchTerms[0] + '|';
|
|
345
|
+
} else {
|
|
346
|
+
this.filteredGridColumns += 'All|';
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
// Reset to the first page
|
|
351
|
+
this.paginationComponent.pageNumber = 1;
|
|
352
|
+
this.currentPage = 1;
|
|
353
|
+
|
|
354
|
+
// dispatch event
|
|
355
|
+
this.onFilterChanged.emit(args);
|
|
356
|
+
this.logger.info('method [onFilterChanged] - onFilterChanged.emit(args) performed, filteredGridColumns=' + this.filteredGridColumns);
|
|
357
|
+
}, timing);
|
|
358
|
+
|
|
359
|
+
this.logger.info('method [onFilterChanged] - END');
|
|
360
|
+
return '';
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
|
|
364
|
+
/**
|
|
365
|
+
* PAGINATION EMIT EVENT
|
|
366
|
+
* @param event
|
|
367
|
+
* @param args
|
|
368
|
+
*/
|
|
369
|
+
processOnPaginationChanged(event: Event | undefined, args: PaginationChangedArgs) {
|
|
370
|
+
this.logger.info('method [onPaginationChanged] - START');
|
|
371
|
+
this.currentPage = args.newPage;
|
|
372
|
+
this.onPaginationChanged.emit(args);
|
|
373
|
+
this.logger.info('method [onPaginationChanged] - END, currentPage=' + this.currentPage);
|
|
374
|
+
return 'onPaginationChanged';
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
/**
|
|
378
|
+
* SORT EMIT EVENT
|
|
379
|
+
* @param event
|
|
380
|
+
* @param args
|
|
381
|
+
*/
|
|
382
|
+
processOnSortChanged(event: Event | undefined, args: any) {
|
|
383
|
+
this.logger.info('method [onSortChanged] - START');
|
|
384
|
+
this.sortedGridColumn = '';
|
|
385
|
+
const sortDirection = '|' + args!.sortCols![0].sortAsc + '|';
|
|
386
|
+
for (let idx = 0; idx < this.columnDefinitions.length; idx++) {
|
|
387
|
+
if (this.columnDefinitions[idx].field === args!.sortCols![0].sortCol.field) {
|
|
388
|
+
this.sortedGridColumn = '' + idx + sortDirection;
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
this.onSortChanged.emit(args);
|
|
392
|
+
this.logger.info('method [onSortChanged] - END, sortedGridColumn=' + this.sortedGridColumn);
|
|
393
|
+
return 'onSortChanged';
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
|
|
397
|
+
|
|
398
|
+
getFilteredGridColumns() {
|
|
399
|
+
return this.filteredGridColumns;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
getSortedGridColumn() {
|
|
403
|
+
return this.sortedGridColumn;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
/******** Pagination+Sot+Filter service: END *****************/
|
|
407
|
+
|
|
408
|
+
|
|
409
|
+
|
|
410
|
+
|
|
411
|
+
|
|
412
|
+
|
|
413
|
+
|
|
414
|
+
// Getters and Setters
|
|
415
|
+
get selectedRow() {
|
|
416
|
+
return this._selectedRow;
|
|
417
|
+
}
|
|
418
|
+
set selectedRow(row: any) {
|
|
419
|
+
this._selectedRow = row;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
get onRowDoubleClick() {
|
|
423
|
+
return this._onRowDoubleClick;
|
|
424
|
+
}
|
|
425
|
+
set onRowDoubleClick(event: Function) {
|
|
426
|
+
this._onRowDoubleClick = event;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
get onRowClick() {
|
|
430
|
+
return this._onRowClick;
|
|
431
|
+
}
|
|
432
|
+
set onRowClick(event: Function) {
|
|
433
|
+
this._onRowClick = event;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
}
|