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,26 @@
|
|
|
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-formatter.component.ts">
|
|
8
|
+
<span class="fa fa-link"></span> code
|
|
9
|
+
</a>
|
|
10
|
+
</span>
|
|
11
|
+
</h2>
|
|
12
|
+
<div class="subtitle"
|
|
13
|
+
[innerHTML]="subTitle"></div>
|
|
14
|
+
|
|
15
|
+
<button class="btn btn-outline-secondary btn-sm"
|
|
16
|
+
(click)="togglePauseResizer()">
|
|
17
|
+
Pause auto-resize: <b>{{resizerPaused}}</b>
|
|
18
|
+
</button>
|
|
19
|
+
|
|
20
|
+
<angular-slickgrid gridId="grid2"
|
|
21
|
+
[columnDefinitions]="columnDefinitions"
|
|
22
|
+
[gridOptions]="gridOptions"
|
|
23
|
+
[dataset]="dataset"
|
|
24
|
+
(onAngularGridCreated)="angularGridReady($event.detail)">
|
|
25
|
+
</angular-slickgrid>
|
|
26
|
+
</div>
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { Component, OnInit } from '@angular/core';
|
|
2
|
+
import { AngularGridInstance, Column, FieldType, Formatter, Formatters, GridOption, } from './../modules/angular-slickgrid';
|
|
3
|
+
|
|
4
|
+
interface DataItem {
|
|
5
|
+
id: number;
|
|
6
|
+
title: string;
|
|
7
|
+
duration: string;
|
|
8
|
+
percentComplete: number;
|
|
9
|
+
percentComplete2: number;
|
|
10
|
+
start: Date;
|
|
11
|
+
finish: Date;
|
|
12
|
+
effortDriven: boolean;
|
|
13
|
+
phone: string;
|
|
14
|
+
completed: number;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// create my custom Formatter with the Formatter type
|
|
18
|
+
const myCustomCheckmarkFormatter: Formatter<DataItem> = (_row, _cell, value) => {
|
|
19
|
+
// you can return a string of a object (of type FormatterResultObject), the 2 types are shown below
|
|
20
|
+
return value ? `<i class="fa fa-fire red" aria-hidden="true"></i>` : { text: '<i class="fa fa-snowflake-o" aria-hidden="true"></i>', addClasses: 'lightblue', toolTip: 'Freezing' };
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const customEnableButtonFormatter: Formatter<DataItem> = (_row: number, _cell: number, value: any) => {
|
|
24
|
+
return `<span style="margin-left: 5px">
|
|
25
|
+
<button class="btn btn-xs btn-default">
|
|
26
|
+
<i class="fa ${value ? 'fa-check-circle' : 'fa-circle-thin'} fa-lg" style="color: ${value ? 'black' : 'lavender'}"></i>
|
|
27
|
+
</button>
|
|
28
|
+
</span>`;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
@Component({
|
|
32
|
+
templateUrl: './grid-formatter.component.html'
|
|
33
|
+
})
|
|
34
|
+
export class GridFormatterComponent implements OnInit {
|
|
35
|
+
title = 'Example 2: Grid with Formatters';
|
|
36
|
+
subTitle = `
|
|
37
|
+
Grid with Custom and/or included Slickgrid Formatters (<a href="https://github.com/ghiscoding/Angular-Slickgrid/wiki/Formatters" target="_blank">Wiki docs</a>).
|
|
38
|
+
<ul>
|
|
39
|
+
<li>The 2 last columns are using Custom Formatters</li>
|
|
40
|
+
<ul><li>The "Completed" column uses a the "onCellClick" event and a formatter to simulate a toggle action</li></ul>
|
|
41
|
+
<li>
|
|
42
|
+
Support Excel Copy Buffer (SlickGrid Copy Manager Plugin), you can use it by simply enabling "enableExcelCopyBuffer" flag.
|
|
43
|
+
Note that it will only evaluate Formatter when the "exportWithFormatter" flag is enabled (through "ExportOptions" or the column definition)
|
|
44
|
+
</li>
|
|
45
|
+
<li>This example also has auto-resize enabled, and we also demo how you can pause the resizer if you wish to</li>
|
|
46
|
+
</ul>
|
|
47
|
+
`;
|
|
48
|
+
|
|
49
|
+
columnDefinitions: Column<DataItem>[] = [];
|
|
50
|
+
gridOptions!: GridOption;
|
|
51
|
+
dataset!: any[];
|
|
52
|
+
angularGrid!: AngularGridInstance;
|
|
53
|
+
resizerPaused = false;
|
|
54
|
+
|
|
55
|
+
angularGridReady(angularGrid: AngularGridInstance) {
|
|
56
|
+
this.angularGrid = angularGrid;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
ngOnInit(): void {
|
|
60
|
+
this.columnDefinitions = [
|
|
61
|
+
{ id: 'title', name: 'Title', field: 'title', sortable: true, type: FieldType.string, width: 70 },
|
|
62
|
+
{ id: 'phone', name: 'Phone Number using mask', field: 'phone', sortable: true, type: FieldType.number, minWidth: 100, formatter: Formatters.mask, params: { mask: '(000) 000-0000' } },
|
|
63
|
+
{ id: 'duration', name: 'Duration (days)', field: 'duration', formatter: Formatters.decimal, params: { minDecimal: 1, maxDecimal: 2 }, sortable: true, type: FieldType.number, minWidth: 90, exportWithFormatter: true },
|
|
64
|
+
{ id: 'complete', name: '% Complete', field: 'percentComplete', formatter: Formatters.percentCompleteBar, type: FieldType.number, sortable: true, minWidth: 100 },
|
|
65
|
+
{ id: 'percent2', name: '% Complete', field: 'percentComplete2', formatter: Formatters.progressBar, type: FieldType.number, sortable: true, minWidth: 100 },
|
|
66
|
+
{ id: 'start', name: 'Start', field: 'start', formatter: Formatters.dateIso, sortable: true, type: FieldType.date, minWidth: 90, exportWithFormatter: true },
|
|
67
|
+
{ id: 'finish', name: 'Finish', field: 'finish', formatter: Formatters.dateIso, sortable: true, type: FieldType.date, minWidth: 90, exportWithFormatter: true },
|
|
68
|
+
{ id: 'effort-driven', name: 'Effort Driven', field: 'effortDriven', formatter: myCustomCheckmarkFormatter, type: FieldType.number, sortable: true, minWidth: 100 },
|
|
69
|
+
{
|
|
70
|
+
id: 'completed', name: 'Completed', field: 'completed', type: FieldType.number, sortable: true, minWidth: 100,
|
|
71
|
+
formatter: customEnableButtonFormatter,
|
|
72
|
+
onCellClick: (e, args) => {
|
|
73
|
+
this.toggleCompletedProperty(args && args.dataContext);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
];
|
|
77
|
+
|
|
78
|
+
this.gridOptions = {
|
|
79
|
+
autoResize: {
|
|
80
|
+
container: '#demo-container',
|
|
81
|
+
rightPadding: 10
|
|
82
|
+
},
|
|
83
|
+
enableAutoResize: true,
|
|
84
|
+
enableCellNavigation: true,
|
|
85
|
+
showCustomFooter: true, // display some metrics in the bottom custom footer
|
|
86
|
+
customFooterOptions: {
|
|
87
|
+
// optionally display some text on the left footer container
|
|
88
|
+
leftFooterText: 'custom footer text',
|
|
89
|
+
hideTotalItemCount: true,
|
|
90
|
+
hideLastUpdateTimestamp: true
|
|
91
|
+
},
|
|
92
|
+
|
|
93
|
+
// you customize all formatter at once certain options through "formatterOptions" in the Grid Options
|
|
94
|
+
// or independently through the column definition "params", the option names are the same
|
|
95
|
+
/*
|
|
96
|
+
formatterOptions: {
|
|
97
|
+
dateSeparator: '.',
|
|
98
|
+
decimalSeparator: ',',
|
|
99
|
+
displayNegativeNumberWithParentheses: true,
|
|
100
|
+
minDecimal: 0,
|
|
101
|
+
maxDecimal: 2,
|
|
102
|
+
thousandSeparator: '_'
|
|
103
|
+
},
|
|
104
|
+
*/
|
|
105
|
+
|
|
106
|
+
// when using the ExcelCopyBuffer, you can see what the selection range is
|
|
107
|
+
enableExcelCopyBuffer: true,
|
|
108
|
+
// excelCopyBufferOptions: {
|
|
109
|
+
// onCopyCells: (e, args: { ranges: SelectedRange[] }) => console.log('onCopyCells', args.ranges),
|
|
110
|
+
// onPasteCells: (e, args: { ranges: SelectedRange[] }) => console.log('onPasteCells', args.ranges),
|
|
111
|
+
// onCopyCancelled: (e, args: { ranges: SelectedRange[] }) => console.log('onCopyCancelled', args.ranges),
|
|
112
|
+
// }
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
// mock a dataset
|
|
116
|
+
this.dataset = [];
|
|
117
|
+
for (let i = 0; i < 500; i++) {
|
|
118
|
+
const randomYear = 2000 + Math.floor(Math.random() * 10);
|
|
119
|
+
const randomMonth = Math.floor(Math.random() * 11);
|
|
120
|
+
const randomDay = Math.floor((Math.random() * 29));
|
|
121
|
+
const randomPercent = Math.round(Math.random() * 100);
|
|
122
|
+
|
|
123
|
+
this.dataset[i] = {
|
|
124
|
+
id: i,
|
|
125
|
+
title: 'Task ' + i,
|
|
126
|
+
phone: this.generatePhoneNumber(),
|
|
127
|
+
duration: (i % 33 === 0) ? null : Math.random() * 100 + '',
|
|
128
|
+
percentComplete: randomPercent,
|
|
129
|
+
percentComplete2: randomPercent,
|
|
130
|
+
percentCompleteNumber: randomPercent,
|
|
131
|
+
start: new Date(randomYear, randomMonth, randomDay),
|
|
132
|
+
finish: new Date(randomYear, (randomMonth + 1), randomDay),
|
|
133
|
+
effortDriven: (i % 5 === 0)
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
generatePhoneNumber(): string {
|
|
139
|
+
let phone = '';
|
|
140
|
+
for (let i = 0; i < 10; i++) {
|
|
141
|
+
phone += Math.round(Math.random() * 9) + '';
|
|
142
|
+
}
|
|
143
|
+
return phone;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
togglePauseResizer() {
|
|
147
|
+
this.resizerPaused = !this.resizerPaused;
|
|
148
|
+
this.angularGrid.resizerService.pauseResizer(this.resizerPaused);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
toggleCompletedProperty(item: any) {
|
|
152
|
+
// toggle property
|
|
153
|
+
if (typeof item === 'object') {
|
|
154
|
+
item.completed = !item.completed;
|
|
155
|
+
|
|
156
|
+
// simulate a backend http call and refresh the grid row after delay
|
|
157
|
+
setTimeout(() => {
|
|
158
|
+
this.angularGrid.gridService.updateItemById(item.id, item, { highlightRow: false });
|
|
159
|
+
}, 250);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
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-frozen.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 gx-2 mb-2 align-items-end">
|
|
15
|
+
<div class="col-2">
|
|
16
|
+
<label for="pinned-rows">Pinned Rows: </label>
|
|
17
|
+
<input id="pinned-rows" class="form-control" type="number" [(ngModel)]="frozenRowCount">
|
|
18
|
+
</div>
|
|
19
|
+
<div class="col-auto gr-2">
|
|
20
|
+
<button class="btn btn-outline-secondary btn-sm" (click)="changeFrozenRowCount()">
|
|
21
|
+
Set
|
|
22
|
+
</button>
|
|
23
|
+
</div>
|
|
24
|
+
<div class="col-1"></div>
|
|
25
|
+
<div class="col-2">
|
|
26
|
+
<label for="pinned-columns">Pinned Columns: </label>
|
|
27
|
+
<input id="pinned-columns" class="form-control" type="number" [(ngModel)]="frozenColumnCount">
|
|
28
|
+
</div>
|
|
29
|
+
<div class="col-auto">
|
|
30
|
+
<button class="btn btn-outline-secondary btn-sm" (click)="changeFrozenColumnCount()">
|
|
31
|
+
Set
|
|
32
|
+
</button>
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
35
|
+
|
|
36
|
+
<div class="row">
|
|
37
|
+
<div class="col-12">
|
|
38
|
+
<button class="btn btn-outline-secondary btn-sm" (click)="setFrozenColumns(-1)"
|
|
39
|
+
data-test="remove-frozen-column-button">
|
|
40
|
+
<i class="fa fa-times fa-lg"></i> Remove Frozen Columns
|
|
41
|
+
</button>
|
|
42
|
+
<button class="btn btn-outline-secondary btn-sm" (click)="setFrozenColumns(2)" data-test="set-3frozen-columns">
|
|
43
|
+
<i class="fa fa-thumb-tack fa-lg"></i> Set 3 Frozen Columns
|
|
44
|
+
</button>
|
|
45
|
+
|
|
46
|
+
<span style="margin-left: 15px">
|
|
47
|
+
<button class="btn btn-outline-secondary btn-sm" (click)="toggleFrozenBottomRows()">
|
|
48
|
+
<i class="fa fa-random fa-lg"></i> Toggle Pinned Rows
|
|
49
|
+
</button>
|
|
50
|
+
<span style="font-weight: bold;">: {{ isFrozenBottom ? 'Bottom' : 'Top' }}</span>
|
|
51
|
+
</span>
|
|
52
|
+
</div>
|
|
53
|
+
</div>
|
|
54
|
+
<div class="row mt-2 mb-2">
|
|
55
|
+
<hr>
|
|
56
|
+
</div>
|
|
57
|
+
<angular-slickgrid gridId="grid20"
|
|
58
|
+
gridWidth="875"
|
|
59
|
+
[columnDefinitions]="columnDefinitions"
|
|
60
|
+
[gridOptions]="gridOptions"
|
|
61
|
+
[dataset]="dataset"
|
|
62
|
+
(onValidationError)="onValidationError($event.detail.eventData, $event.detail.args)"
|
|
63
|
+
(onAngularGridCreated)="angularGridReady($event.detail)">
|
|
64
|
+
</angular-slickgrid>
|
|
65
|
+
</div>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** You can change the pinned/frozen border styling through this css override */
|
|
2
|
+
|
|
3
|
+
.slick-row .slick-cell.frozen:last-child,
|
|
4
|
+
.slick-headerrow-column.frozen:last-child,
|
|
5
|
+
.slick-footerrow-column.frozen:last-child {
|
|
6
|
+
border-right: 1px solid #969696 !important;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.slick-pane-bottom {
|
|
10
|
+
border-top: 1px solid #969696 !important;
|
|
11
|
+
}
|
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
import { Component, OnInit, OnDestroy, ViewEncapsulation } from '@angular/core';
|
|
2
|
+
import { AngularGridInstance, Column, ColumnEditorDualInput, Editors, FieldType, formatNumber, Formatters, Filters, GridOption, SlickNamespace } from './../modules/angular-slickgrid';
|
|
3
|
+
|
|
4
|
+
declare const Slick: SlickNamespace;
|
|
5
|
+
|
|
6
|
+
@Component({
|
|
7
|
+
templateUrl: './grid-frozen.component.html',
|
|
8
|
+
styleUrls: ['./grid-frozen.component.scss'],
|
|
9
|
+
encapsulation: ViewEncapsulation.None,
|
|
10
|
+
})
|
|
11
|
+
export class GridFrozenComponent implements OnInit, OnDestroy {
|
|
12
|
+
title = 'Example 20: Pinned (frozen) Columns/Rows';
|
|
13
|
+
subTitle = `
|
|
14
|
+
This example demonstrates the use of Pinned (aka frozen) Columns and/or Rows (<a href="https://github.com/ghiscoding/Angular-Slickgrid/wiki/Pinned-(aka-Frozen)-Columns-Rows" target="_blank">Wiki docs</a>)
|
|
15
|
+
<ul>
|
|
16
|
+
<li>Option to pin any number of columns (left only) or rows</li>
|
|
17
|
+
<li>Option to pin the rows at the bottom instead of the top (default)</li>
|
|
18
|
+
<li>You can also dynamically any of these options, through SlickGrid "setOptions()"</li>
|
|
19
|
+
<li>Possibility to change the styling of the line border between pinned columns/rows</li>
|
|
20
|
+
</ul>
|
|
21
|
+
`;
|
|
22
|
+
|
|
23
|
+
angularGrid!: AngularGridInstance;
|
|
24
|
+
columnDefinitions!: Column[];
|
|
25
|
+
gridOptions!: GridOption;
|
|
26
|
+
dataset!: any[];
|
|
27
|
+
frozenColumnCount = 2;
|
|
28
|
+
frozenRowCount = 3;
|
|
29
|
+
isFrozenBottom = false;
|
|
30
|
+
gridObj: any;
|
|
31
|
+
slickEventHandler: any;
|
|
32
|
+
|
|
33
|
+
constructor() {
|
|
34
|
+
this.slickEventHandler = new Slick.EventHandler();
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
ngOnInit(): void {
|
|
38
|
+
this.prepareDataGrid();
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
ngOnDestroy() {
|
|
42
|
+
// unsubscribe all SlickGrid events
|
|
43
|
+
this.slickEventHandler.unsubscribeAll();
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
angularGridReady(angularGrid: AngularGridInstance) {
|
|
47
|
+
this.angularGrid = angularGrid;
|
|
48
|
+
this.gridObj = angularGrid.slickGrid;
|
|
49
|
+
|
|
50
|
+
// with frozen (pinned) grid, in order to see the entire row being highlighted when hovering
|
|
51
|
+
// we need to do some extra tricks (that is because frozen grids use 2 separate div containers)
|
|
52
|
+
// the trick is to use row selection to highlight when hovering current row and remove selection once we're not
|
|
53
|
+
this.slickEventHandler.subscribe(this.gridObj.onMouseEnter, (event: Event) => this.highlightRow(event, true));
|
|
54
|
+
this.slickEventHandler.subscribe(this.gridObj.onMouseLeave, (event: Event) => this.highlightRow(event, false));
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
highlightRow(event: Event, isMouseEnter: boolean) {
|
|
58
|
+
const cell = this.gridObj.getCellFromEvent(event);
|
|
59
|
+
const rows = isMouseEnter ? [cell?.row ?? 0] : [];
|
|
60
|
+
this.gridObj.setSelectedRows(rows); // highlight current row
|
|
61
|
+
event.preventDefault();
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
prepareDataGrid() {
|
|
65
|
+
this.columnDefinitions = [
|
|
66
|
+
{
|
|
67
|
+
id: 'sel', name: '#', field: 'id',
|
|
68
|
+
minWidth: 40, width: 40, maxWidth: 40,
|
|
69
|
+
cannotTriggerInsert: true,
|
|
70
|
+
resizable: false,
|
|
71
|
+
unselectable: true,
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
id: 'title', name: 'Title', field: 'title',
|
|
75
|
+
minWidth: 100, width: 120,
|
|
76
|
+
filterable: true,
|
|
77
|
+
sortable: true
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
id: 'percentComplete', name: '% Complete', field: 'percentComplete',
|
|
81
|
+
resizable: false,
|
|
82
|
+
minWidth: 130, width: 140,
|
|
83
|
+
formatter: Formatters.percentCompleteBar,
|
|
84
|
+
type: FieldType.number,
|
|
85
|
+
filterable: true,
|
|
86
|
+
filter: { model: Filters.slider, operator: '>=' },
|
|
87
|
+
sortable: true
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
id: 'start', name: 'Start', field: 'start',
|
|
91
|
+
minWidth: 100, width: 120,
|
|
92
|
+
filterable: true, sortable: true,
|
|
93
|
+
formatter: Formatters.dateIso
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
id: 'finish', name: 'Finish', field: 'finish',
|
|
97
|
+
minWidth: 100, width: 120,
|
|
98
|
+
filterable: true, sortable: true,
|
|
99
|
+
formatter: Formatters.dateIso
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
id: 'cost', name: 'Cost | Duration', field: 'cost',
|
|
103
|
+
formatter: this.costDurationFormatter.bind(this),
|
|
104
|
+
minWidth: 150, width: 170,
|
|
105
|
+
sortable: true,
|
|
106
|
+
// filterable: true,
|
|
107
|
+
filter: {
|
|
108
|
+
model: Filters.compoundSlider,
|
|
109
|
+
},
|
|
110
|
+
editor: {
|
|
111
|
+
model: Editors.dualInput,
|
|
112
|
+
// the DualInputEditor is of Type ColumnEditorDualInput and MUST include (leftInput/rightInput) in its params object
|
|
113
|
+
// in each of these 2 properties, you can pass any regular properties of a column editor
|
|
114
|
+
// and they will be executed following the options defined in each
|
|
115
|
+
params: {
|
|
116
|
+
leftInput: {
|
|
117
|
+
field: 'cost',
|
|
118
|
+
type: 'float',
|
|
119
|
+
decimal: 2,
|
|
120
|
+
minValue: 0,
|
|
121
|
+
maxValue: 50000,
|
|
122
|
+
placeholder: '< 50K',
|
|
123
|
+
errorMessage: 'Cost must be positive and below $50K.',
|
|
124
|
+
},
|
|
125
|
+
rightInput: {
|
|
126
|
+
field: 'duration',
|
|
127
|
+
type: 'float', // you could have 2 different input type as well
|
|
128
|
+
minValue: 0,
|
|
129
|
+
maxValue: 100,
|
|
130
|
+
title: 'make sure Duration is withing its range of 0 to 100',
|
|
131
|
+
errorMessage: 'Duration must be between 0 and 100.',
|
|
132
|
+
|
|
133
|
+
// Validator Option #1
|
|
134
|
+
// You could also optionally define a custom validator in 1 or both inputs
|
|
135
|
+
/*
|
|
136
|
+
validator: (value, args) => {
|
|
137
|
+
let isValid = true;
|
|
138
|
+
let errorMsg = '';
|
|
139
|
+
if (value < 0 || value > 120) {
|
|
140
|
+
isValid = false;
|
|
141
|
+
errorMsg = 'Duration MUST be between 0 and 120.';
|
|
142
|
+
}
|
|
143
|
+
return { valid: isValid, msg: errorMsg };
|
|
144
|
+
}
|
|
145
|
+
*/
|
|
146
|
+
},
|
|
147
|
+
} as ColumnEditorDualInput,
|
|
148
|
+
|
|
149
|
+
// Validator Option #2 (shared Validator) - this is the last alternative, option #1 (independent Validators) is still the recommended way
|
|
150
|
+
// You can also optionally use a common Validator (if you do then you cannot use the leftInput/rightInput validators at same time)
|
|
151
|
+
// to compare both values at the same time.
|
|
152
|
+
/*
|
|
153
|
+
validator: (values, args) => {
|
|
154
|
+
let isValid = true;
|
|
155
|
+
let errorMsg = '';
|
|
156
|
+
if (values.cost < 0 || values.cost > 50000) {
|
|
157
|
+
isValid = false;
|
|
158
|
+
errorMsg = 'Cost MUST be between 0 and 50k.';
|
|
159
|
+
}
|
|
160
|
+
if (values.duration < 0 || values.duration > 120) {
|
|
161
|
+
isValid = false;
|
|
162
|
+
errorMsg = 'Duration MUST be between 0 and 120.';
|
|
163
|
+
}
|
|
164
|
+
if (values.cost < values.duration) {
|
|
165
|
+
isValid = false;
|
|
166
|
+
errorMsg = 'Cost can never be lower than its Duration.';
|
|
167
|
+
}
|
|
168
|
+
return { valid: isValid, msg: errorMsg };
|
|
169
|
+
}
|
|
170
|
+
*/
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
id: 'effortDriven', name: 'Effort Driven', field: 'effortDriven',
|
|
175
|
+
minWidth: 100, width: 120,
|
|
176
|
+
formatter: Formatters.checkmark,
|
|
177
|
+
filterable: true,
|
|
178
|
+
filter: {
|
|
179
|
+
collection: [{ value: '', label: '' }, { value: true, label: 'True' }, { value: false, label: 'False' }],
|
|
180
|
+
model: Filters.singleSelect
|
|
181
|
+
},
|
|
182
|
+
sortable: true
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
id: 'title1', name: 'Title 1', field: 'title1',
|
|
186
|
+
minWidth: 100, width: 120,
|
|
187
|
+
filterable: true,
|
|
188
|
+
sortable: true
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
id: 'title2', name: 'Title 2', field: 'title2',
|
|
192
|
+
minWidth: 100, width: 120,
|
|
193
|
+
filterable: true,
|
|
194
|
+
sortable: true
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
id: 'title3', name: 'Title 3', field: 'title3',
|
|
198
|
+
minWidth: 100, width: 120,
|
|
199
|
+
filterable: true,
|
|
200
|
+
sortable: true
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
id: 'title4', name: 'Title 4', field: 'title4',
|
|
204
|
+
minWidth: 100, width: 120,
|
|
205
|
+
filterable: true,
|
|
206
|
+
sortable: true
|
|
207
|
+
}
|
|
208
|
+
];
|
|
209
|
+
|
|
210
|
+
this.gridOptions = {
|
|
211
|
+
autoResize: {
|
|
212
|
+
container: '#demo-container',
|
|
213
|
+
rightPadding: 10
|
|
214
|
+
},
|
|
215
|
+
enableExcelCopyBuffer: true,
|
|
216
|
+
enableCellNavigation: true,
|
|
217
|
+
editable: true,
|
|
218
|
+
autoEdit: true,
|
|
219
|
+
asyncEditorLoading: true,
|
|
220
|
+
frozenColumn: this.frozenColumnCount,
|
|
221
|
+
frozenRow: this.frozenRowCount,
|
|
222
|
+
// frozenBottom: true, // if you want to freeze the bottom instead of the top, you can enable this property
|
|
223
|
+
|
|
224
|
+
gridMenu: { hideClearFrozenColumnsCommand: false },
|
|
225
|
+
headerMenu: { hideFreezeColumnsCommand: false }
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
// mock a dataset
|
|
229
|
+
this.dataset = this.getData();
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
getData() {
|
|
233
|
+
// Set up some test columns.
|
|
234
|
+
const mockDataset = [];
|
|
235
|
+
for (let i = 0; i < 500; i++) {
|
|
236
|
+
mockDataset[i] = {
|
|
237
|
+
id: i,
|
|
238
|
+
title: 'Task ' + i,
|
|
239
|
+
cost: (i % 33 === 0) ? null : Math.random() * 10000,
|
|
240
|
+
duration: i % 8 ? (Math.round(Math.random() * 100) + '') : null,
|
|
241
|
+
percentComplete: Math.round(Math.random() * 100),
|
|
242
|
+
start: new Date(2009, 0, 1),
|
|
243
|
+
finish: new Date(2009, 4, 5),
|
|
244
|
+
effortDriven: (i % 5 === 0),
|
|
245
|
+
title1: `Some Text ${Math.round(Math.random() * 25)}`,
|
|
246
|
+
title2: `Some Text ${Math.round(Math.random() * 25)}`,
|
|
247
|
+
title3: `Some Text ${Math.round(Math.random() * 25)}`,
|
|
248
|
+
title4: `Some Text ${Math.round(Math.random() * 25)}`,
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
return mockDataset;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/** change dynamically, through slickgrid "setOptions()" the number of pinned columns */
|
|
255
|
+
changeFrozenColumnCount() {
|
|
256
|
+
if (this.gridObj && this.gridObj.setOptions) {
|
|
257
|
+
this.gridObj.setOptions({
|
|
258
|
+
frozenColumn: this.frozenColumnCount
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/** change dynamically, through slickgrid "setOptions()" the number of pinned rows */
|
|
264
|
+
changeFrozenRowCount() {
|
|
265
|
+
if (this.gridObj && this.gridObj.setOptions) {
|
|
266
|
+
this.gridObj.setOptions({
|
|
267
|
+
frozenRow: this.frozenRowCount
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
costDurationFormatter(_row: number, _cell: number, _value: any, _columnDef: Column, dataContext: any) {
|
|
273
|
+
const costText = this.isNullUndefinedOrEmpty(dataContext.cost) ? 'n/a' : formatNumber(dataContext.cost, 0, 2, false, '$', '', '.', ',');
|
|
274
|
+
let durationText = 'n/a';
|
|
275
|
+
if (!this.isNullUndefinedOrEmpty(dataContext.duration) && dataContext.duration >= 0) {
|
|
276
|
+
durationText = `${dataContext.duration} ${dataContext.duration > 1 ? 'days' : 'day'}`;
|
|
277
|
+
}
|
|
278
|
+
return `<b>${costText}</b> | ${durationText}`;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
isNullUndefinedOrEmpty(data: any) {
|
|
282
|
+
return (data === '' || data === null || data === undefined);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
onValidationError(e: Event, args: any) {
|
|
286
|
+
alert(args.validationResults.msg);
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
setFrozenColumns(frozenCols: number) {
|
|
290
|
+
this.gridObj.setOptions({ frozenColumn: frozenCols });
|
|
291
|
+
this.gridOptions = this.gridObj.getOptions();
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
/** toggle dynamically, through slickgrid "setOptions()" the top/bottom pinned location */
|
|
295
|
+
toggleFrozenBottomRows() {
|
|
296
|
+
if (this.gridObj && this.gridObj.setOptions) {
|
|
297
|
+
this.gridObj.setOptions({
|
|
298
|
+
frozenBottom: !this.isFrozenBottom
|
|
299
|
+
});
|
|
300
|
+
this.isFrozenBottom = !this.isFrozenBottom; // toggle the variable
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
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-graphql-nopage.component.ts">
|
|
8
|
+
<span class="fa fa-link"></span> code
|
|
9
|
+
</a>
|
|
10
|
+
</span>
|
|
11
|
+
</h2>
|
|
12
|
+
<div class="subtitle row">
|
|
13
|
+
<div class="col-12" [innerHTML]="subTitle">
|
|
14
|
+
</div>
|
|
15
|
+
</div>
|
|
16
|
+
|
|
17
|
+
<div class="row">
|
|
18
|
+
<div class="col-xs-6 col-sm-3">
|
|
19
|
+
<div [class]="status.class" role="alert" data-test="status">
|
|
20
|
+
<strong>Status: </strong> {{status.text}}
|
|
21
|
+
<span [hidden]="!processing">
|
|
22
|
+
<i class="fa fa-refresh fa-spin fa-lg fa-fw"></i>
|
|
23
|
+
</span>
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
26
|
+
</div>
|
|
27
|
+
|
|
28
|
+
<angular-slickgrid gridId="grid27"
|
|
29
|
+
[columnDefinitions]="columnDefinitions"
|
|
30
|
+
[gridOptions]="gridOptions"
|
|
31
|
+
[dataset]="dataset">
|
|
32
|
+
</angular-slickgrid>
|
|
33
|
+
</div>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
$slick-preheader-font-size: 18px;
|
|
2
|
+
$slick-preheader-border-right: 1px solid lightgrey;
|
|
3
|
+
|
|
4
|
+
/* make sure to add the @import the SlickGrid Bootstrap Theme AFTER the variables changes */
|
|
5
|
+
@import '@slickgrid-universal/common/dist/styles/sass/slickgrid-theme-bootstrap.scss';
|
|
6
|
+
|
|
7
|
+
.alert {
|
|
8
|
+
padding: 8px;
|
|
9
|
+
}
|