angular-slickgrid 9.0.0 → 9.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/{dist/fesm2022 → fesm2022}/angular-slickgrid.mjs +16 -16
- package/package.json +27 -14
- package/.gitbook.yaml +0 -5
- package/CHANGELOG.md +0 -1691
- package/CONTRIBUTING.md +0 -17
- package/angular.json +0 -133
- package/coverage/base.css +0 -224
- package/coverage/block-navigation.js +0 -87
- package/coverage/clover.xml +0 -1620
- package/coverage/coverage-final.json +0 -9
- package/coverage/favicon.png +0 -0
- package/coverage/index.html +0 -176
- package/coverage/library/components/angular-slickgrid.component.ts.html +0 -5074
- package/coverage/library/components/index.html +0 -116
- package/coverage/library/constants.ts.html +0 -397
- package/coverage/library/extensions/index.html +0 -116
- package/coverage/library/extensions/slickRowDetailView.ts.html +0 -1261
- package/coverage/library/index.html +0 -116
- package/coverage/library/modules/angular-slickgrid.module.ts.html +0 -166
- package/coverage/library/modules/index.html +0 -116
- package/coverage/library/services/angularUtil.service.ts.html +0 -445
- package/coverage/library/services/container.service.ts.html +0 -163
- package/coverage/library/services/index.html +0 -161
- package/coverage/library/services/translater.service.ts.html +0 -199
- package/coverage/library/services/utilities.ts.html +0 -142
- package/coverage/prettify.css +0 -1
- package/coverage/prettify.js +0 -2
- package/coverage/sort-arrow-sprite.png +0 -0
- package/coverage/sorter.js +0 -196
- package/dist/LICENSE +0 -21
- package/dist/README.md +0 -142
- package/docs/README.md +0 -5
- package/docs/TOC.md +0 -105
- package/docs/backend-services/Custom-Backend-Service.md +0 -50
- package/docs/backend-services/GraphQL.md +0 -276
- package/docs/backend-services/OData.md +0 -245
- package/docs/backend-services/graphql/GraphQL-Filtering.md +0 -156
- package/docs/backend-services/graphql/GraphQL-JSON-Result.md +0 -85
- package/docs/backend-services/graphql/GraphQL-Pagination.md +0 -77
- package/docs/backend-services/graphql/GraphQL-Sorting.md +0 -78
- package/docs/column-functionalities/cell-menu.md +0 -212
- package/docs/column-functionalities/editors/autocomplete-editor.md +0 -466
- package/docs/column-functionalities/editors/date-editor-flatpickr.md +0 -71
- package/docs/column-functionalities/editors/date-editor-vanilla-calendar.md +0 -91
- package/docs/column-functionalities/editors/longtext-editor-textarea.md +0 -80
- package/docs/column-functionalities/editors/select-dropdown-editor.md +0 -227
- package/docs/column-functionalities/editors.md +0 -604
- package/docs/column-functionalities/filters/autocomplete-filter.md +0 -183
- package/docs/column-functionalities/filters/compound-filters.md +0 -234
- package/docs/column-functionalities/filters/custom-filter.md +0 -117
- package/docs/column-functionalities/filters/filter-intro.md +0 -81
- package/docs/column-functionalities/filters/input-filter.md +0 -260
- package/docs/column-functionalities/filters/range-filters.md +0 -188
- package/docs/column-functionalities/filters/select-filter.md +0 -695
- package/docs/column-functionalities/filters/single-search-filter.md +0 -77
- package/docs/column-functionalities/filters/styling-filled-filters.md +0 -45
- package/docs/column-functionalities/formatters.md +0 -325
- package/docs/column-functionalities/sorting.md +0 -200
- package/docs/developer-guides/csp-compliance.md +0 -64
- package/docs/events/Available-Events.md +0 -223
- package/docs/events/Grid-&-DataView-Events.md +0 -211
- package/docs/getting-started/quick-start.md +0 -230
- package/docs/getting-started/troubleshooting.md +0 -80
- package/docs/grid-functionalities/Column-Picker.md +0 -22
- package/docs/grid-functionalities/Composite-Editor-Modal.md +0 -627
- package/docs/grid-functionalities/Context-Menu.md +0 -226
- package/docs/grid-functionalities/Custom-Footer.md +0 -80
- package/docs/grid-functionalities/Custom-Tooltip-(plugin).md +0 -258
- package/docs/grid-functionalities/Export-to-Excel.md +0 -457
- package/docs/grid-functionalities/Export-to-Text-File.md +0 -165
- package/docs/grid-functionalities/FAQ.md +0 -53
- package/docs/grid-functionalities/Global-Options.md +0 -29
- package/docs/grid-functionalities/Grid-Auto-Resize.md +0 -218
- package/docs/grid-functionalities/Grid-Menu.md +0 -134
- package/docs/grid-functionalities/Grid-State-&-Preset.md +0 -245
- package/docs/grid-functionalities/Header-Menu-&-Header-Buttons.md +0 -125
- package/docs/grid-functionalities/Resize-by-Cell-Content.md +0 -138
- package/docs/grid-functionalities/Row-Selection.md +0 -247
- package/docs/grid-functionalities/Row-based-edit.md +0 -71
- package/docs/grid-functionalities/add-update-highlight.md +0 -258
- package/docs/grid-functionalities/column-row-spanning.md +0 -74
- package/docs/grid-functionalities/dynamic-item-metadata.md +0 -124
- package/docs/grid-functionalities/excel-copy-buffer.md +0 -145
- package/docs/grid-functionalities/frozen-columns-rows.md +0 -164
- package/docs/grid-functionalities/grouping-and-aggregators.md +0 -269
- package/docs/grid-functionalities/header-footer-slots.md +0 -22
- package/docs/grid-functionalities/infinite-scroll.md +0 -150
- package/docs/grid-functionalities/providing-grid-data.md +0 -61
- package/docs/grid-functionalities/row-detail.md +0 -530
- package/docs/grid-functionalities/tree-data-grid.md +0 -391
- package/docs/localization/Localization---Component-Sample.md +0 -87
- package/docs/localization/Localization-with-Custom-Locales.md +0 -66
- package/docs/localization/Localization-with-ngx-translate.md +0 -148
- package/docs/migrations/migration-to-2.x.md +0 -304
- package/docs/migrations/migration-to-3.x.md +0 -295
- package/docs/migrations/migration-to-4.x.md +0 -83
- package/docs/migrations/migration-to-5.x.md +0 -160
- package/docs/migrations/migration-to-6.x.md +0 -128
- package/docs/migrations/migration-to-7.x.md +0 -294
- package/docs/migrations/migration-to-8.x.md +0 -316
- package/docs/migrations/migration-to-9.x.md +0 -219
- package/docs/slick-grid-dataview-objects/slickgrid-dataview-objects.md +0 -79
- package/docs/styling/dark-mode.md +0 -100
- package/docs/styling/styling.md +0 -250
- package/docs/testing/testing-patterns.md +0 -73
- package/eslint.config.mjs +0 -60
- package/ng-package.json +0 -10
- package/src/assets/angular-logo.png +0 -0
- package/src/assets/angular-logo2.png +0 -0
- package/src/assets/data/collection_100_numbers.json +0 -12
- package/src/assets/data/collection_500_numbers.json +0 -52
- package/src/assets/data/countries.json +0 -245
- package/src/assets/data/country_names.json +0 -245
- package/src/assets/data/customers_100.json +0 -102
- package/src/assets/data/users.csv +0 -5
- package/src/assets/i18n/en.json +0 -102
- package/src/assets/i18n/fr.json +0 -103
- package/src/demos/app-routing.module.ts +0 -108
- package/src/demos/app.component.html +0 -187
- package/src/demos/app.component.scss +0 -79
- package/src/demos/app.component.ts +0 -11
- package/src/demos/app.module.ts +0 -196
- package/src/demos/environments/environment.dev.ts +0 -3
- package/src/demos/environments/environment.prod.ts +0 -3
- package/src/demos/environments/environment.ts +0 -8
- package/src/demos/examples/custom-angularComponentEditor.ts +0 -187
- package/src/demos/examples/custom-angularComponentFilter.ts +0 -123
- package/src/demos/examples/custom-buttonFormatter.component.ts +0 -13
- package/src/demos/examples/custom-inputEditor.ts +0 -132
- package/src/demos/examples/custom-inputFilter.ts +0 -134
- package/src/demos/examples/custom-titleFormatter.component.ts +0 -9
- package/src/demos/examples/data/collection_100_numbers.json +0 -12
- package/src/demos/examples/data/collection_500_numbers.json +0 -52
- package/src/demos/examples/data/countries.json +0 -245
- package/src/demos/examples/data/country_names.json +0 -245
- package/src/demos/examples/data/customers_100.json +0 -102
- package/src/demos/examples/data/users.csv +0 -5
- package/src/demos/examples/editor-ng-select.component.ts +0 -38
- package/src/demos/examples/example01.component.html +0 -48
- package/src/demos/examples/example01.component.ts +0 -109
- package/src/demos/examples/example02.component.html +0 -45
- package/src/demos/examples/example02.component.ts +0 -218
- package/src/demos/examples/example03.component.html +0 -118
- package/src/demos/examples/example03.component.ts +0 -694
- package/src/demos/examples/example04.component.html +0 -87
- package/src/demos/examples/example04.component.ts +0 -326
- package/src/demos/examples/example05.component.html +0 -151
- package/src/demos/examples/example05.component.ts +0 -474
- package/src/demos/examples/example06.component.html +0 -163
- package/src/demos/examples/example06.component.ts +0 -446
- package/src/demos/examples/example07.component.html +0 -56
- package/src/demos/examples/example07.component.scss +0 -10
- package/src/demos/examples/example07.component.ts +0 -216
- package/src/demos/examples/example08.component.html +0 -51
- package/src/demos/examples/example08.component.scss +0 -23
- package/src/demos/examples/example08.component.ts +0 -195
- package/src/demos/examples/example09.component.html +0 -55
- package/src/demos/examples/example09.component.scss +0 -22
- package/src/demos/examples/example09.component.ts +0 -302
- package/src/demos/examples/example10.component.html +0 -103
- package/src/demos/examples/example10.component.ts +0 -309
- package/src/demos/examples/example11.component.html +0 -91
- package/src/demos/examples/example11.component.ts +0 -276
- package/src/demos/examples/example12.component.html +0 -98
- package/src/demos/examples/example12.component.ts +0 -317
- package/src/demos/examples/example13.component.html +0 -96
- package/src/demos/examples/example13.component.ts +0 -370
- package/src/demos/examples/example14.component.html +0 -50
- package/src/demos/examples/example14.component.scss +0 -11
- package/src/demos/examples/example14.component.ts +0 -156
- package/src/demos/examples/example15.component.html +0 -56
- package/src/demos/examples/example15.component.ts +0 -304
- package/src/demos/examples/example16.component.html +0 -77
- package/src/demos/examples/example16.component.ts +0 -277
- package/src/demos/examples/example17.component.html +0 -50
- package/src/demos/examples/example17.component.ts +0 -109
- package/src/demos/examples/example18.component.html +0 -132
- package/src/demos/examples/example18.component.ts +0 -445
- package/src/demos/examples/example19-rowdetail.component.html +0 -40
- package/src/demos/examples/example19-rowdetail.component.ts +0 -54
- package/src/demos/examples/example19.component.html +0 -79
- package/src/demos/examples/example19.component.ts +0 -316
- package/src/demos/examples/example20.component.html +0 -76
- package/src/demos/examples/example20.component.scss +0 -11
- package/src/demos/examples/example20.component.ts +0 -341
- package/src/demos/examples/example21.component.html +0 -86
- package/src/demos/examples/example21.component.scss +0 -16
- package/src/demos/examples/example21.component.ts +0 -140
- package/src/demos/examples/example22.component.html +0 -41
- package/src/demos/examples/example22.component.ts +0 -117
- package/src/demos/examples/example23.component.html +0 -111
- package/src/demos/examples/example23.component.ts +0 -323
- package/src/demos/examples/example24.component.html +0 -120
- package/src/demos/examples/example24.component.scss +0 -62
- package/src/demos/examples/example24.component.ts +0 -641
- package/src/demos/examples/example25.component.html +0 -60
- package/src/demos/examples/example25.component.scss +0 -8
- package/src/demos/examples/example25.component.ts +0 -255
- package/src/demos/examples/example26.component.html +0 -98
- package/src/demos/examples/example26.component.scss +0 -42
- package/src/demos/examples/example26.component.ts +0 -383
- package/src/demos/examples/example27.component.html +0 -138
- package/src/demos/examples/example27.component.scss +0 -10
- package/src/demos/examples/example27.component.ts +0 -369
- package/src/demos/examples/example28.component.html +0 -143
- package/src/demos/examples/example28.component.scss +0 -54
- package/src/demos/examples/example28.component.ts +0 -453
- package/src/demos/examples/example29.component.html +0 -30
- package/src/demos/examples/example29.component.ts +0 -70
- package/src/demos/examples/example30.component.html +0 -116
- package/src/demos/examples/example30.component.scss +0 -20
- package/src/demos/examples/example30.component.ts +0 -1070
- package/src/demos/examples/example32.component.html +0 -77
- package/src/demos/examples/example32.component.scss +0 -8
- package/src/demos/examples/example32.component.ts +0 -905
- package/src/demos/examples/example33.component.html +0 -50
- package/src/demos/examples/example33.component.scss +0 -46
- package/src/demos/examples/example33.component.ts +0 -571
- package/src/demos/examples/example34.component.html +0 -82
- package/src/demos/examples/example34.component.scss +0 -77
- package/src/demos/examples/example34.component.ts +0 -434
- package/src/demos/examples/example35.component.html +0 -77
- package/src/demos/examples/example35.component.scss +0 -18
- package/src/demos/examples/example35.component.ts +0 -264
- package/src/demos/examples/example36.component.html +0 -56
- package/src/demos/examples/example36.component.scss +0 -26
- package/src/demos/examples/example36.component.ts +0 -504
- package/src/demos/examples/example37.component.html +0 -30
- package/src/demos/examples/example37.component.ts +0 -123
- package/src/demos/examples/example38.component.html +0 -104
- package/src/demos/examples/example38.component.scss +0 -8
- package/src/demos/examples/example38.component.ts +0 -420
- package/src/demos/examples/example39.component.html +0 -112
- package/src/demos/examples/example39.component.scss +0 -8
- package/src/demos/examples/example39.component.ts +0 -371
- package/src/demos/examples/example40.component.html +0 -76
- package/src/demos/examples/example40.component.ts +0 -226
- package/src/demos/examples/example41.component.html +0 -50
- package/src/demos/examples/example41.component.scss +0 -42
- package/src/demos/examples/example41.component.ts +0 -229
- package/src/demos/examples/example42.component.html +0 -47
- package/src/demos/examples/example42.component.ts +0 -203
- package/src/demos/examples/example43.component.html +0 -94
- package/src/demos/examples/example43.component.scss +0 -30
- package/src/demos/examples/example43.component.ts +0 -449
- package/src/demos/examples/example44.component.html +0 -78
- package/src/demos/examples/example44.component.scss +0 -50
- package/src/demos/examples/example44.component.ts +0 -375
- package/src/demos/examples/example45-detail.component.html +0 -15
- package/src/demos/examples/example45-detail.component.ts +0 -97
- package/src/demos/examples/example45.component.html +0 -110
- package/src/demos/examples/example45.component.scss +0 -50
- package/src/demos/examples/example45.component.ts +0 -243
- package/src/demos/examples/filter-ng-select.component.ts +0 -33
- package/src/demos/examples/grid-custom-pager.component.html +0 -60
- package/src/demos/examples/grid-custom-pager.component.scss +0 -57
- package/src/demos/examples/grid-custom-pager.component.ts +0 -107
- package/src/demos/examples/grid-remote.component.html +0 -44
- package/src/demos/examples/grid-remote.component.ts +0 -164
- package/src/demos/examples/home.component.html +0 -39
- package/src/demos/examples/home.component.ts +0 -10
- package/src/demos/examples/jsonp.ts +0 -89
- package/src/demos/examples/rowdetail-preload.component.ts +0 -10
- package/src/demos/examples/swt-common-grid-pagination.component.ts +0 -160
- package/src/demos/examples/swt-common-grid-test.component.html +0 -37
- package/src/demos/examples/swt-common-grid-test.component.ts +0 -214
- package/src/demos/examples/swt-common-grid.component.ts +0 -436
- package/src/demos/examples/swt-logger.service.ts +0 -173
- package/src/demos/examples/utilities.ts +0 -9
- package/src/favicon.ico +0 -0
- package/src/index.html +0 -17
- package/src/library/components/__tests__/angular-slickgrid.component.spec.ts +0 -2638
- package/src/library/components/angular-slickgrid.component.html +0 -5
- package/src/library/components/angular-slickgrid.component.ts +0 -1662
- package/src/library/constants.ts +0 -105
- package/src/library/extensions/__tests__/slickRowDetailView.spec.ts +0 -751
- package/src/library/extensions/index.ts +0 -1
- package/src/library/extensions/slickRowDetailView.ts +0 -395
- package/src/library/global-grid-options.ts +0 -273
- package/src/library/index.ts +0 -11
- package/src/library/models/angularComponentOutput.interface.ts +0 -6
- package/src/library/models/angularGridInstance.interface.ts +0 -76
- package/src/library/models/externalTestingDependencies.interface.ts +0 -37
- package/src/library/models/gridOption.interface.ts +0 -15
- package/src/library/models/index.ts +0 -5
- package/src/library/models/rowDetailView.interface.ts +0 -16
- package/src/library/modules/angular-slickgrid.module.spec.ts +0 -25
- package/src/library/modules/angular-slickgrid.module.ts +0 -27
- package/src/library/services/__tests__/angularUtilService.spec.ts +0 -156
- package/src/library/services/__tests__/container.service.spec.ts +0 -25
- package/src/library/services/__tests__/translater.service.spec.ts +0 -43
- package/src/library/services/__tests__/utilities.spec.ts +0 -22
- package/src/library/services/angularUtil.service.ts +0 -120
- package/src/library/services/container.service.ts +0 -26
- package/src/library/services/index.ts +0 -4
- package/src/library/services/translater.service.ts +0 -38
- package/src/library/services/utilities.ts +0 -19
- package/src/library/slickgrid-config.ts +0 -10
- package/src/main.ts +0 -13
- package/src/public_api.ts +0 -1
- package/src/styles.scss +0 -178
- package/test/cypress/e2e/example01.cy.ts +0 -367
- package/test/cypress/e2e/example02.cy.ts +0 -60
- package/test/cypress/e2e/example03.cy.ts +0 -268
- package/test/cypress/e2e/example04.cy.ts +0 -254
- package/test/cypress/e2e/example05.cy.ts +0 -804
- package/test/cypress/e2e/example06.cy.ts +0 -890
- package/test/cypress/e2e/example07.cy.ts +0 -384
- package/test/cypress/e2e/example08.cy.ts +0 -190
- package/test/cypress/e2e/example09.cy.ts +0 -392
- package/test/cypress/e2e/example10.cy.ts +0 -650
- package/test/cypress/e2e/example11.cy.ts +0 -86
- package/test/cypress/e2e/example12.cy.ts +0 -269
- package/test/cypress/e2e/example13.cy.ts +0 -246
- package/test/cypress/e2e/example14.cy.ts +0 -122
- package/test/cypress/e2e/example15.cy.ts +0 -598
- package/test/cypress/e2e/example16.cy.ts +0 -427
- package/test/cypress/e2e/example17.cy.ts +0 -83
- package/test/cypress/e2e/example18.cy.ts +0 -431
- package/test/cypress/e2e/example19.cy.ts +0 -263
- package/test/cypress/e2e/example20.cy.ts +0 -264
- package/test/cypress/e2e/example21.cy.ts +0 -77
- package/test/cypress/e2e/example22.cy.ts +0 -94
- package/test/cypress/e2e/example23.cy.ts +0 -259
- package/test/cypress/e2e/example24.cy.ts +0 -707
- package/test/cypress/e2e/example25.cy.ts +0 -193
- package/test/cypress/e2e/example26.cy.ts +0 -111
- package/test/cypress/e2e/example27.cy.ts +0 -261
- package/test/cypress/e2e/example28.cy.ts +0 -740
- package/test/cypress/e2e/example29.cy.ts +0 -30
- package/test/cypress/e2e/example30.cy.ts +0 -757
- package/test/cypress/e2e/example31.cy.ts +0 -69
- package/test/cypress/e2e/example32.cy.ts +0 -272
- package/test/cypress/e2e/example33.cy.ts +0 -278
- package/test/cypress/e2e/example34.cy.ts +0 -84
- package/test/cypress/e2e/example35.cy.ts +0 -178
- package/test/cypress/e2e/example36.cy.ts +0 -219
- package/test/cypress/e2e/example37.cy.ts +0 -52
- package/test/cypress/e2e/example38.cy.ts +0 -160
- package/test/cypress/e2e/example39.cy.ts +0 -150
- package/test/cypress/e2e/example40.cy.ts +0 -126
- package/test/cypress/e2e/example41.cy.ts +0 -90
- package/test/cypress/e2e/example42.cy.ts +0 -82
- package/test/cypress/e2e/example43.cy.ts +0 -482
- package/test/cypress/e2e/example44.cy.ts +0 -458
- package/test/cypress/e2e/example45.cy.ts +0 -455
- package/test/cypress/e2e/home.cy.ts +0 -7
- package/test/cypress/fixtures/example.json +0 -5
- package/test/cypress/plugins/index.ts +0 -17
- package/test/cypress/plugins/utilities.ts +0 -28
- package/test/cypress/support/commands.ts +0 -88
- package/test/cypress/support/common.ts +0 -47
- package/test/cypress/support/drag.ts +0 -101
- package/test/cypress/support/index.ts +0 -20
- package/test/cypress/tsconfig.json +0 -9
- package/test/cypress.config.ts +0 -34
- package/test/mockSlickEvent.ts +0 -77
- package/test/rxjsResourceStub.ts +0 -69
- package/test/test-setup.ts +0 -6
- package/test/translateServiceStub.ts +0 -230
- package/test/translaterServiceStub.ts +0 -239
- package/test/tsconfig.json +0 -17
- package/test/vitest-global-mocks.ts +0 -41
- package/test/vitest-global-setup.ts +0 -3
- package/test/vitest-pretest.ts +0 -5
- package/tsconfig.app.json +0 -14
- package/tsconfig.json +0 -31
- package/tsconfig.spec.json +0 -11
- package/types/sortablejs.d.ts +0 -4
- package/vite.config.mts +0 -51
- /package/{dist/fesm2022 → fesm2022}/angular-slickgrid.mjs.map +0 -0
- /package/{dist/i18n → i18n}/en.json +0 -0
- /package/{dist/i18n → i18n}/fr.json +0 -0
- /package/{dist/index.d.ts → index.d.ts} +0 -0
- /package/{dist/library → library}/components/angular-slickgrid.component.d.ts +0 -0
- /package/{dist/library → library}/constants.d.ts +0 -0
- /package/{dist/library → library}/extensions/index.d.ts +0 -0
- /package/{dist/library → library}/extensions/slickRowDetailView.d.ts +0 -0
- /package/{dist/library → library}/global-grid-options.d.ts +0 -0
- /package/{dist/library → library}/index.d.ts +0 -0
- /package/{dist/library → library}/models/angularComponentOutput.interface.d.ts +0 -0
- /package/{dist/library → library}/models/angularGridInstance.interface.d.ts +0 -0
- /package/{dist/library → library}/models/externalTestingDependencies.interface.d.ts +0 -0
- /package/{dist/library → library}/models/gridOption.interface.d.ts +0 -0
- /package/{dist/library → library}/models/index.d.ts +0 -0
- /package/{dist/library → library}/models/rowDetailView.interface.d.ts +0 -0
- /package/{dist/library → library}/modules/angular-slickgrid.module.d.ts +0 -0
- /package/{dist/library → library}/services/angularUtil.service.d.ts +0 -0
- /package/{dist/library → library}/services/container.service.d.ts +0 -0
- /package/{dist/library → library}/services/index.d.ts +0 -0
- /package/{dist/library → library}/services/translater.service.d.ts +0 -0
- /package/{dist/library → library}/services/utilities.d.ts +0 -0
- /package/{dist/library → library}/slickgrid-config.d.ts +0 -0
- /package/{dist/public_api.d.ts → public_api.d.ts} +0 -0
|
@@ -1,391 +0,0 @@
|
|
|
1
|
-
#### Index
|
|
2
|
-
- [Parent/Child Relation Dataset](#parentchild-relation-dataset)
|
|
3
|
-
- [Hierarchical (Tree) Dataset](#hierarchical-tree-dataset)
|
|
4
|
-
- [Tree Formatter (with Collapsing icons](#tree-formatter)
|
|
5
|
-
- [Tree Custom Title Formatter](#tree-custom-title-formatter)
|
|
6
|
-
- [Exporting Options (data export to Excel/Text File)](#exporting-options-data-export-to-exceltext-file)
|
|
7
|
-
- [Full List of `treeDataOptions`](https://github.com/ghiscoding/slickgrid-universal/blob/master/packages/common/src/interfaces/treeDataOption.interface.ts)
|
|
8
|
-
- Filtering Options
|
|
9
|
-
- [`excludeChildrenWhenFilteringTree`](#excludechildrenwhenfilteringtree-boolean-option)
|
|
10
|
-
- [`autoApproveParentItemWhenTreeColumnIsValid`](#autoapproveparentitemwhentreecolumnisvalid-boolean-option)
|
|
11
|
-
- [Tree Data Service Methods](#tree-data-service-methods) - extra methods to work with Tree Data
|
|
12
|
-
- `getItemCount(x)`, `getToggledItems()`, `getCurrentToggleState()`, `dynamicallyToggleItemState(x)`, `applyToggledItemStateChanges(x)`, ...
|
|
13
|
-
- [Tree Totals with Aggregators](#tree-totals-with-aggregators)
|
|
14
|
-
|
|
15
|
-
## Description
|
|
16
|
-
Tree Data allows you to display a hierarchical (tree) dataset into the grid, it is visually very similar to Grouping but also very different in its implementation. A hierarchical dataset is commonly used for a parent/child relation and a great example is a Bill of Material (BOM), which you can't do with Grouping because parent/child relationship could be infinite tree level while Grouping is a defined and known level of Grouping.
|
|
17
|
-
|
|
18
|
-
## Important Notes
|
|
19
|
-
|
|
20
|
-
#### data mutation
|
|
21
|
-
|
|
22
|
-
For Tree Data to work with SlickGrid we need to **mutate** the original dataset, it will add a couple of new properties to your data, these properties are: `__treeLevel`, `__parentId` and `children` (these key names could be changed via the `treeDataOptions`). Also note that these properties become available in every Formatter (built-in and custom) which can be quite useful (especially in the tree level) in some cases... You might be thinking, could we do it without mutating the data? Probably but that would require to do a deep copy of the original data and that can be expensive on the performance side (no one it stopping you from doing a deep copy on your side though). The last thing to note is that internally for Tree Data to work, the lib always has 2 dataset (1x flat dataset and 1x hierarchical dataset which is basically a tree structure) and the lib keeps them in sync internally. So why do we do all of this? Well simply put, SlickGrid itself does not support a Tree Data structure and that is the reason we always have to keep 2 dataset structures internally because SlickGrid only works a flat dataset and nothing else.
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
#### Filtering is required by Tree Data
|
|
26
|
-
|
|
27
|
-
Tree Data requires and uses Filters to work, you **cannot disable Filtering**. The way it works is that when you collapse a parent group, the grid is actually using Filters to filter out child rows and so expanding/collapsing groups which is why Filtering must be enabled. If you don't want to show Filters to the user, then use `showHeaderRow: false` grid option and/or toggle it from the Grid Menu. Also, if you don't want to see the Grid Menu toggle filter command, you should also hide it from the menu via `gridMenu: { hideToggleFilterCommand: true }`
|
|
28
|
-
|
|
29
|
-
### Demo
|
|
30
|
-
[Demo Parent/Child Relationship](https://ghiscoding.github.io/Angular-Slickgrid/#/tree-data-parent-child) / [Component](https://github.com/ghiscoding/slickgrid-universal/blob/master/frameworks/angular-slickgrid/src/demos/examples/grid-tree-data-parent-child.component.ts)
|
|
31
|
-
|
|
32
|
-
[Hierarchial Dataset](https://ghiscoding.github.io/Angular-Slickgrid/#/tree-data-hierarchical) / [Component](https://github.com/ghiscoding/slickgrid-universal/blob/master/frameworks/angular-slickgrid/src/demos/examples/grid-tree-data-hierarchical.component.ts)
|
|
33
|
-
|
|
34
|
-
## Parent/Child Relation Dataset
|
|
35
|
-
This is the most common Tree Data to use, we only use that one in our projects, and requires you to provide a key representing the relation between the parent and children (typically a `parentId`, which the default key when nothing is provided).
|
|
36
|
-
|
|
37
|
-
For example, we can see below is that we have a regular flat dataset with items that have a `parentId` property which defines the relation between the parent and child.
|
|
38
|
-
|
|
39
|
-
###### View
|
|
40
|
-
```html
|
|
41
|
-
<angular-slickgrid gridId="grid1"
|
|
42
|
-
[columns]="columnDefinitions"
|
|
43
|
-
[options]="gridOptions"
|
|
44
|
-
[dataset]="dataset"
|
|
45
|
-
(onAngularGridCreated)="angularGridReady($event.detail)">
|
|
46
|
-
</angular-slickgrid>
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
###### dataset sample
|
|
50
|
-
```ts
|
|
51
|
-
this.dataset = [
|
|
52
|
-
{ id: 0, file: 'documents', parentId: null, },
|
|
53
|
-
{ id: 1, file: 'vacation.txt', parentId: 0, },
|
|
54
|
-
{ id: 2, file: 'bills.txt', parentId: 0, },
|
|
55
|
-
{ id: 55: file: 'music', parentId: null, },
|
|
56
|
-
{ id: 60, file: 'favorite-song.mp3', parentId: 55, },
|
|
57
|
-
{ id: 61, file: 'blues.mp3', parentId: 61, },
|
|
58
|
-
];
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
_For the full list of options, refer to the [treeDataOptions](https://github.com/ghiscoding/slickgrid-universal/blob/master/packages/common/src/interfaces/treeDataOption.interface.ts) interface_
|
|
62
|
-
|
|
63
|
-
###### define your grid
|
|
64
|
-
```ts
|
|
65
|
-
defineGrid() {
|
|
66
|
-
this.columnDefinitions = [
|
|
67
|
-
{
|
|
68
|
-
id: 'title', name: 'Title', field: 'title', width: 220, cssClass: 'cell-title',
|
|
69
|
-
filterable: true, sortable: true,
|
|
70
|
-
formatter: Formatters.tree, exportCustomFormatter: Formatters.treeExport
|
|
71
|
-
},
|
|
72
|
-
// ...
|
|
73
|
-
];
|
|
74
|
-
|
|
75
|
-
this.gridOptions = {
|
|
76
|
-
enableFiltering: true, // <<-- REQUIRED, it won't work without filtering enabled
|
|
77
|
-
multiColumnSort: false, // <<-- REQUIRED to be Disabled since multi-column sorting is not currently supported with Tree Data
|
|
78
|
-
|
|
79
|
-
treeDataOptions: {
|
|
80
|
-
columnId: 'title', // the column where you will have the Tree with collapse/expand icons
|
|
81
|
-
parentPropName: 'parentId', // the parent/child key relation in your dataset
|
|
82
|
-
levelPropName: 'treeLevel', // optionally, you can define the tree level property name, it nothing is provided it will use "__treeLevel"
|
|
83
|
-
indentMarginLeft: 15, // optionally provide the indent spacer width in pixel, for example if you provide 10 and your tree level is 2 then it will have 20px of indentation
|
|
84
|
-
exportIndentMarginLeft: 4, // similar to `indentMarginLeft` but represent a space instead of pixels for the Export CSV/Excel
|
|
85
|
-
|
|
86
|
-
// you can optionally sort by a different column and/or sort direction
|
|
87
|
-
// this is the RECOMMENDED approach, unless you are 100% that your original array is already sorted (in most cases it's not)
|
|
88
|
-
initialSort: {
|
|
89
|
-
columnId: 'title', // which column are we using to do the initial sort? it doesn't have to be the tree column, it could be any column
|
|
90
|
-
direction: 'ASC'
|
|
91
|
-
},
|
|
92
|
-
},
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
## Hierarchical (Tree) Dataset
|
|
98
|
-
This is when your dataset is already in hierarchical (tree) structure, for example your items array already has a tree where the parents have a children property array that contains other items.
|
|
99
|
-
|
|
100
|
-
For example, we can see below the children are in the `files` array and the entire dataset is already in a hierarchical (tree) structure.
|
|
101
|
-
|
|
102
|
-
_For the full list of options, refer to the [treeDataOptions](https://github.com/ghiscoding/slickgrid-universal/blob/master/packages/common/src/interfaces/treeDataOption.interface.ts) interface_
|
|
103
|
-
|
|
104
|
-
###### View
|
|
105
|
-
```html
|
|
106
|
-
<angular-slickgrid gridId="grid1"
|
|
107
|
-
[columns]="columnDefinitions"
|
|
108
|
-
[options]="gridOptions"
|
|
109
|
-
[datasetHierarchical]="datasetHierarchical"
|
|
110
|
-
(onAngularGridCreated)="angularGridReady($event.detail)">
|
|
111
|
-
</angular-slickgrid>
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
###### dataset sample
|
|
115
|
-
```ts
|
|
116
|
-
this.datasetHierarchical = [
|
|
117
|
-
{ id: 0, file: 'documents', files: [
|
|
118
|
-
{ id: 1, file: 'vacation.txt', size: 12 },
|
|
119
|
-
{ id: 2, file: 'bills.txt', size: 0.5 }
|
|
120
|
-
]
|
|
121
|
-
},
|
|
122
|
-
{ id: 55: file: 'music', files: [
|
|
123
|
-
{ id: 60, file: 'favorite-song.mp3': size: 2.3 },
|
|
124
|
-
{ id: 61, file: 'blues.mp3', size: 5.5 }
|
|
125
|
-
]
|
|
126
|
-
},
|
|
127
|
-
];
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
###### define your grid
|
|
131
|
-
```ts
|
|
132
|
-
initializeGrid() {
|
|
133
|
-
this.columnDefinitions = [
|
|
134
|
-
{
|
|
135
|
-
id: 'file', name: 'Files', field: 'file',
|
|
136
|
-
width: 150, formatter: this.treeFormatter,
|
|
137
|
-
filterable: true, sortable: true,
|
|
138
|
-
},
|
|
139
|
-
// ...
|
|
140
|
-
];
|
|
141
|
-
|
|
142
|
-
this.gridOptions = {
|
|
143
|
-
enableFiltering: true, // <<-- REQUIRED, it won't work without filtering enabled
|
|
144
|
-
multiColumnSort: false, // <<-- REQUIRED to be Disabled since multi-column sorting is not currently supported with Tree Data
|
|
145
|
-
|
|
146
|
-
treeDataOptions: {
|
|
147
|
-
columnId: 'file', // the column where you will have the Tree with collapse/expand icons
|
|
148
|
-
parentPropName: 'files', // the parent/child key relation in your dataset
|
|
149
|
-
levelPropName: 'treeLevel', // optionally, you can define the tree level property name, it nothing is provided it will use "__treeLevel"
|
|
150
|
-
|
|
151
|
-
// you can optionally sort by a different column and/or sort direction
|
|
152
|
-
// this is the RECOMMENDED approach, unless you are 100% that your original array is already sorted (in most cases it's not)
|
|
153
|
-
initialSort: {
|
|
154
|
-
columnId: 'size', // which column are we using to do the initial sort? it doesn't have to be the tree column, it could be any column
|
|
155
|
-
direction: 'DESC'
|
|
156
|
-
},
|
|
157
|
-
},
|
|
158
|
-
};
|
|
159
|
-
}
|
|
160
|
-
```
|
|
161
|
-
|
|
162
|
-
### Tree Custom Title Formatter
|
|
163
|
-
The column with the Tree already has a Formatter, so how can we add our own Formatter without impacting the Tree collapse/expand icons? You can use the `titleFormatter` in your `treeDataOptions`, it will style the text title but won't impact the collapsing icons.
|
|
164
|
-
|
|
165
|
-
###### grid options configurations
|
|
166
|
-
```ts
|
|
167
|
-
this.gridOptions = {
|
|
168
|
-
enableFiltering: true, // <<-- REQUIRED, it won't work without filtering enabled
|
|
169
|
-
multiColumnSort: false, // <<-- REQUIRED to be Disabled since multi-column sorting is not currently supported with Tree Data
|
|
170
|
-
|
|
171
|
-
treeDataOptions: {
|
|
172
|
-
columnId: 'title', // the column where you will have the Tree with collapse/expand icons
|
|
173
|
-
// ...
|
|
174
|
-
|
|
175
|
-
// we can also add a Custom Formatter just for the title text portion
|
|
176
|
-
titleFormatter: (_row, _cell, value, _def, dataContext) => {
|
|
177
|
-
let prefix = '';
|
|
178
|
-
if (dataContext.treeLevel > 0) {
|
|
179
|
-
prefix = `<span class="mdi mdi-subdirectory-arrow-right"></span>`;
|
|
180
|
-
}
|
|
181
|
-
return `${prefix}<span class="bold">${value}</span><span style="font-size:11px; margin-left: 15px;">(parentId: ${dataContext.parentId})</span>`;
|
|
182
|
-
},
|
|
183
|
-
},
|
|
184
|
-
};
|
|
185
|
-
```
|
|
186
|
-
|
|
187
|
-
### Tree Formatter
|
|
188
|
-
|
|
189
|
-
> **Note** is it mandatory to add a Formatter on the column holding the tree, the Formatter is what creates the expand/collapse icon the parents. This the biggest error that many users forget to do.
|
|
190
|
-
|
|
191
|
-
You would typically use the built-in `Formatters.tree` to show the tree but in some cases you might want to use your own Formatter and that is fine, it's like any other Custom Formatter. Here's a demo of the [Example 29](https://ghiscoding.github.io/Angular-Slickgrid/#/tree-data-hierarchical) Custom Formatter which is specific for showing the collapsing icon and folder and files icons.
|
|
192
|
-
|
|
193
|
-
```ts
|
|
194
|
-
treeFormatter: Formatter = (row, cell, value, columnDef, dataContext, grid) => {
|
|
195
|
-
const gridOptions = grid.getOptions() as GridOption;
|
|
196
|
-
const treeLevelPropName = gridOptions?.treeDataOptions?.levelPropName || '__treeLevel';
|
|
197
|
-
if (value === null || value === undefined || dataContext === undefined) {
|
|
198
|
-
return '';
|
|
199
|
-
}
|
|
200
|
-
const dataView = grid.getData() as SlickDataView;
|
|
201
|
-
const data = dataView.getItems();
|
|
202
|
-
const identifierPropName = dataView.getIdPropertyName() || 'id';
|
|
203
|
-
const idx = dataView.getIdxById(dataContext[identifierPropName]);
|
|
204
|
-
const prefix = this.getFileIcon(value);
|
|
205
|
-
|
|
206
|
-
value = value.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
|
|
207
|
-
const spacer = `<span style="display:inline-block; width:${(15 * dataContext[treeLevelPropName])}px;"></span>`;
|
|
208
|
-
|
|
209
|
-
if (data[idx + 1] && data[idx + 1][treeLevelPropName] > data[idx][treeLevelPropName]) {
|
|
210
|
-
const folderPrefix = `<i class="mdi icon ${dataContext.__collapsed ? 'mdi-folder' : 'mdi-folder-open'}"></i>`;
|
|
211
|
-
if (dataContext.__collapsed) {
|
|
212
|
-
return `${spacer} <span class="slick-group-toggle collapsed" level="${dataContext[treeLevelPropName]}"></span>${folderPrefix} ${prefix} ${value}`;
|
|
213
|
-
} else {
|
|
214
|
-
return `${spacer} <span class="slick-group-toggle expanded" level="${dataContext[treeLevelPropName]}"></span>${folderPrefix} ${prefix} ${value}`;
|
|
215
|
-
}
|
|
216
|
-
} else {
|
|
217
|
-
return `${spacer} <span class="slick-group-toggle" level="${dataContext[treeLevelPropName]}"></span>${prefix} ${value}`;
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
```
|
|
221
|
-
|
|
222
|
-
### Exporting Options (data export to Excel/Text File)
|
|
223
|
-
Exporting the data and keeping the tree level indentation requires a few little tricks and a few options were added to configure them. First off we need a leading character on the left because Excel will trim any spaces and so if our indentation is only spaces then everything gets trimmed and so for that we reason we have the character `·` at the start of every text and then the indentation spaces and that won't be trimmed. Here's a few of the options available.
|
|
224
|
-
|
|
225
|
-
_For the full list of options, refer to the [treeDataOptions](https://github.com/ghiscoding/slickgrid-universal/blob/master/packages/common/src/interfaces/treeDataOption.interface.ts) interface_
|
|
226
|
-
|
|
227
|
-
```ts
|
|
228
|
-
/**
|
|
229
|
-
* Defaults to 5, indentation spaces to add from the left (calculated by the tree level multiplied by this number).
|
|
230
|
-
* For example if tree depth level is 2, the calculation will be (2 * 15 = 30), so the column will be displayed 30px from the left
|
|
231
|
-
*/
|
|
232
|
-
exportIndentMarginLeft?: number;
|
|
233
|
-
|
|
234
|
-
/**
|
|
235
|
-
* Defaults to centered dot (·), we added this because Excel seems to trim spaces leading character
|
|
236
|
-
* and if we add a regular character like a dot then it keeps all tree level indentation spaces
|
|
237
|
-
*/
|
|
238
|
-
exportIndentationLeadingChar?: string;
|
|
239
|
-
|
|
240
|
-
/**
|
|
241
|
-
* Defaults to 3, when using a collapsing icon then we need to add some extra spaces to compensate on parent level.
|
|
242
|
-
* If you don't want collapsing icon in your export then you probably want to put this option at 0.
|
|
243
|
-
*/
|
|
244
|
-
exportIndentationLeadingSpaceCount?: number;
|
|
245
|
-
```
|
|
246
|
-
|
|
247
|
-
### Filtering Options
|
|
248
|
-
#### `excludeChildrenWhenFilteringTree` boolean option
|
|
249
|
-
##### (see animated gif below for a demo)
|
|
250
|
-
When using Tree Data, in most cases we will want to see the content (children) of a parent item when filtering but in some cases we might actually want to exclude them and that is what this flag is for.
|
|
251
|
-
|
|
252
|
-
The full explanation of how filter works is the following
|
|
253
|
-
by default (unless this feature is disabled) all child nodes of the tree will be included when a parent passes a filter and a group will be included if
|
|
254
|
-
1- it has any children that passes the filter or
|
|
255
|
-
2- current parent item passes the filter or
|
|
256
|
-
3- current parent item filter is the Tree column and it passes that filter criteria regardless of other criteria (this is optional via the flag `autoApproveParentItemWhenTreeColumnIsValid: true`)
|
|
257
|
-
* - even when the other columns don't pass the filter criteria, as use case described below
|
|
258
|
-
* - for example if we take the Example with File Explorer (live demo) and we filter (Files = "music" and Size > 7),
|
|
259
|
-
* - then the File "Music" will always show even if it doesn't have a Size because its tree column passes the filter (which was Files = "music")
|
|
260
|
-
* - and the reason we do this is that we'll be able to show music files with "Size > 7" even though these files might not include the word "music"
|
|
261
|
-
|
|
262
|
-
#### `autoApproveParentItemWhenTreeColumnIsValid` boolean option
|
|
263
|
-
##### (see animated gif below for a demo)
|
|
264
|
-
as described in previous paragraph on the number 3), we can auto-approve item if it's the column holding the Tree structure and is a Parent that passes the first filter criteria, in other words if we are on the column holding the Tree and its filter is valid (and is also a parent), then skip any other filter(s) that exist on the same line.
|
|
265
|
-
|
|
266
|
-
For demo purpose, let's take [Example 29](https://ghiscoding.github.io/Angular-Slickgrid/#/tree-data-hierarchical) live demo, if we filter with the word `music` on the "Files" column and also a Size that is `> 15` nothing will show up unless we have this flag enabled. The reason is because none of the files have both criteria passing at the same time, however the "Files" column (which is the Tree column) does pass the filter criteria of `music` and so this flag will work and show the folder "music" because we skipped all other criteria, in our case `> 15` on that line, note however that on the following lines (all children), it will require all filters to be valid (and so we are able to see any files under the "music" folder that have a size greater than 15Mb).
|
|
267
|
-
|
|
268
|
-

|
|
269
|
-
|
|
270
|
-
### Tree Data Service Methods
|
|
271
|
-
There are a few methods available from the `TreeDataService` (only listing the important ones below)
|
|
272
|
-
- `getItemCount(x)`: returns item count of a group
|
|
273
|
-
- `getToggledItems()`: returns all toggled items
|
|
274
|
-
- `getCurrentToggleState()`: get the current toggle state that includes the toggled type and toggled items
|
|
275
|
-
- `dynamicallyToggleItemState(x)`: dynamically toggle and change state of certain parent items by providing an array of parentIds
|
|
276
|
-
- `applyToggledItemStateChanges(x)`: apply different tree toggle state changes (to ALL rows, the entire dataset) by providing an array of parentIds
|
|
277
|
-
|
|
278
|
-
For example
|
|
279
|
-
```ts
|
|
280
|
-
export class Example1 {
|
|
281
|
-
angularGrid?: AngularGridInstance;
|
|
282
|
-
|
|
283
|
-
angularGridReady(angularGrid: AngularGridInstance) {
|
|
284
|
-
this.angularGrid = angularGrid;
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
getTreeDataState() {
|
|
288
|
-
// for example get current Tree Data toggled state
|
|
289
|
-
console.log(this.angularGrid.getCurrentToggleState());
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
```
|
|
293
|
-
|
|
294
|
-
### Tree Totals with Aggregators
|
|
295
|
-
|
|
296
|
-
You can calculate Tree Totals by adding Aggregators to your `treeDataOptions` configuration in your grid options. The Aggregators are the same ones that can be used for both Tree Data and/or Grouping usage (they were modified internally to work for both use case). This feature also comes with other options that you can choose to enable or not, below is a list of these extra options that can be configured
|
|
297
|
-
- `aggregators`: list of Aggregators (one or more Aggregators), must be an array
|
|
298
|
-
- `autoRecalcTotalsOnFilterChange`: do we want to auto-recalculate the tree totals anytime a filter changes
|
|
299
|
-
- option defaults to `false` for perf reason, so by default the totals will not be recalculated while filtering unless this option is enabled (opt-in option)
|
|
300
|
-
- unless you add/remove an item, in which occasion it will recalculate every time
|
|
301
|
-
- `autoRecalcTotalsDebounce`: when previous option is enabled, we can also add a debounce value to avoid calling too many recalculations for each filter chars typed (this can be useful to improve perf on large tree dataset)
|
|
302
|
-
|
|
303
|
-
> **Note** if you were thinking to add both `AvgAggregator` and `SumAggregator`, well the latter can be omitted since the `AvgAggregator` will automatically give you access to the exact same tree totals properties which are `sum`, `count` and `avg` since it needs them all to calculate its average. So if you want to improve perf, you can skip the `SumAggregator` and keep only `AvgAggregator` to still gain access to all 3 totals props simply by calling the Average Aggregator (and that was intentional and not a coincidence). Incidentally, the same is true for `CountAggregator` as well.
|
|
304
|
-
|
|
305
|
-
The available Aggregators that were modified to support Tree Totals aggregations are:
|
|
306
|
-
- `AvgAggregator`: average of a tree
|
|
307
|
-
- `CountAggregator`: count all items of a tree
|
|
308
|
-
- `SumAggregator`: sum of a tree
|
|
309
|
-
- `MinAggregator`: minimum value found in the tree
|
|
310
|
-
- `MaxAggregator`: maximum value found in the tree
|
|
311
|
-
|
|
312
|
-
For example, let say that we want to have Sum and Average in our tree, we can use the code below
|
|
313
|
-
```ts
|
|
314
|
-
this.gridOptions = {
|
|
315
|
-
treeDataOptions: {
|
|
316
|
-
columnId: 'file',
|
|
317
|
-
// ...
|
|
318
|
-
|
|
319
|
-
// aggregators: [new Aggregators.Avg('size'), new Aggregators.Sum('size')],
|
|
320
|
-
|
|
321
|
-
// OR EVEN BETTER, for better perf, you can simply use Avg to get both totals
|
|
322
|
-
aggregators: [new Aggregators.Avg('size')], // produce the same as [new Aggregators.Avg('size'), new Aggregators.Sum('size')]
|
|
323
|
-
|
|
324
|
-
// do we want to auto-recalc Tree Totals when using filters, that is anytime a filter changes
|
|
325
|
-
autoRecalcTotalsOnFilterChange: true, // defaults to FALSE
|
|
326
|
-
|
|
327
|
-
// add optional debounce time to limit number of execution that recalc is called, mostly useful on large dataset
|
|
328
|
-
// autoRecalcTotalsDebounce: 250,
|
|
329
|
-
},
|
|
330
|
-
};
|
|
331
|
-
```
|
|
332
|
-
|
|
333
|
-
### Tree Totals Formatter
|
|
334
|
-
There is also a new and optional Formatter, `Formatters.treeParseTotals`, that was created to allow the use of the same existing `GroupTotalsFormatter`, you also have the option to use your own custom Formatter, the choice is yours and Example 6 demos both. You can provide the new `treeTotalsFormatter` (or use `groupTotalsFormatter` since it's an alias) option to your column definition by providing a `GroupTotalFormatters`
|
|
335
|
-
|
|
336
|
-
#### with `Formatters.treeParseTotals`
|
|
337
|
-
```ts
|
|
338
|
-
this.columnDefinitions = [
|
|
339
|
-
{
|
|
340
|
-
id: 'size', name: 'Size', field: 'size', minWidth: 90,
|
|
341
|
-
|
|
342
|
-
// Formatter option #1 (treeParseTotalFormatters)
|
|
343
|
-
// if you wish to use any of the GroupTotalFormatters (or even regular Formatters), we can do so with the code below
|
|
344
|
-
// use `treeTotalsFormatter` or `groupTotalsFormatter` to show totals in a Tree Data grid
|
|
345
|
-
// provide any regular formatters inside the params.formatters
|
|
346
|
-
formatter: Formatters.treeParseTotals,
|
|
347
|
-
treeTotalsFormatter: GroupTotalFormatters.sumTotalsBold,
|
|
348
|
-
// groupTotalsFormatter: GroupTotalFormatters.sumTotalsBold, // alias
|
|
349
|
-
|
|
350
|
-
// you can add extra settings to your regular GroupTotalFormatters via the `params`
|
|
351
|
-
params: {
|
|
352
|
-
formatters: [
|
|
353
|
-
groupFormatterSuffix: ' MB',
|
|
354
|
-
minDecimal: 0,
|
|
355
|
-
maxDecimal: 2,
|
|
356
|
-
},
|
|
357
|
-
},
|
|
358
|
-
];
|
|
359
|
-
```
|
|
360
|
-
|
|
361
|
-
#### with Custom Formatter
|
|
362
|
-
```ts
|
|
363
|
-
this.columnDefinitions = [
|
|
364
|
-
{
|
|
365
|
-
id: 'size', name: 'Size', field: 'size', minWidth: 90,
|
|
366
|
-
|
|
367
|
-
// OR option #2 (custom Formatter)
|
|
368
|
-
formatter: (_row, _cell, value, column, dataContext) => {
|
|
369
|
-
// parent items will a "__treeTotals" property (when creating the Tree and running Aggregation, it mutates all items, all extra props starts with "__" prefix)
|
|
370
|
-
const fieldId = column.field;
|
|
371
|
-
|
|
372
|
-
// Tree Totals, if exists, will be found under `__treeTotals` prop
|
|
373
|
-
if (dataContext?.__treeTotals !== undefined) {
|
|
374
|
-
const treeLevel = dataContext[this.gridOptions?.treeDataOptions?.levelPropName || '__treeLevel'];
|
|
375
|
-
const sumVal = dataContext?.__treeTotals?.['sum'][fieldId];
|
|
376
|
-
const avgVal = dataContext?.__treeTotals?.['avg'][fieldId];
|
|
377
|
-
|
|
378
|
-
if (avgVal !== undefined && sumVal !== undefined) {
|
|
379
|
-
// when found Avg & Sum, we'll display both
|
|
380
|
-
return isNaN(sumVal) ? '' : `<span class="color-primary bold">sum: ${decimalFormatted(sumVal, 0, 2)} MB</span> / <span class="avg-total">avg: ${decimalFormatted(avgVal, 0, 2)} MB</span> <span class="total-suffix">(${treeLevel === 0 ? 'total' : 'sub-total'})</span>`;
|
|
381
|
-
} else if (sumVal !== undefined) {
|
|
382
|
-
// or when only Sum is aggregated, then just show Sum
|
|
383
|
-
return isNaN(sumVal) ? '' : `<span class="color-primary bold">sum: ${decimalFormatted(sumVal, 0, 2)} MB</span> <span class="total-suffix">(${treeLevel === 0 ? 'total' : 'sub-total'})</span>`;
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
// reaching this line means it's a regular dataContext without totals, so regular formatter output will be used
|
|
387
|
-
return !isNumber(value) ? '' : `${value} MB`;
|
|
388
|
-
},
|
|
389
|
-
},
|
|
390
|
-
];
|
|
391
|
-
```
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
#### Class sample
|
|
2
|
-
You need to add a translation key via the property `nameKey` to each column definition, for example: `nameKey: 'TITLE'`
|
|
3
|
-
|
|
4
|
-
##### Translation Files
|
|
5
|
-
If you want to manually re-create the translation in your own files, the list of translations that you will need are displayed in the [asset i18n](https://github.com/ghiscoding/angular-slickgrid/tree/master/src/assets/i18n) translation folder (from that file, you need all translations shown before the translation 'BILLING', the next few ones are for the demo page only). If you need more information on how to import translations, please review the other [docs](../localization/Localization-with-ngx-translate.md#locales) page.
|
|
6
|
-
|
|
7
|
-
##### Note
|
|
8
|
-
For the `Select` Filter, you will use `labelKey` instead of `label`. Anytime a translation key will come in play, we will add the word `key` to the end (hence `nameKey`, `labelKey`, more to come...)
|
|
9
|
-
```typescript
|
|
10
|
-
import { Component, OnInit, Injectable } from '@angular/core';
|
|
11
|
-
import { Column, Editors, Formatter, Formatters, GridExtraService, GridExtraUtils, GridOption, OnEventArgs, ResizerService } from 'angular-slickgrid';
|
|
12
|
-
import { TranslateService } from '@ngx-translate/core';
|
|
13
|
-
|
|
14
|
-
@Component({
|
|
15
|
-
templateUrl: './grid-localization.component.html'
|
|
16
|
-
})
|
|
17
|
-
@Injectable()
|
|
18
|
-
export class Example implements OnInit {
|
|
19
|
-
gridOptions: GridOption;
|
|
20
|
-
columnDefinitions: Column[];
|
|
21
|
-
dataset: any[];
|
|
22
|
-
|
|
23
|
-
constructor(private translate: TranslateService) {
|
|
24
|
-
// define the grid options & columns and then create the grid itself
|
|
25
|
-
this.defineGrid();
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
// Define grid Options and Columns
|
|
29
|
-
// provide a nameKey for each column and enableTranslate to True in GridOption
|
|
30
|
-
defineGrid() {
|
|
31
|
-
this.columnDefinitions = [
|
|
32
|
-
{ id: 'title', name: 'Title', field: 'title', nameKey: 'TITLE', formatter: this.taskTranslateFormatter, sortable: true, minWidth: 100 },
|
|
33
|
-
{ id: 'duration', name: 'Duration (days)', field: 'duration', nameKey: 'DURATION', sortable: true, minWidth: 100 },
|
|
34
|
-
{ id: 'start', name: 'Start', field: 'start', nameKey: 'START', formatter: Formatters.dateIso, minWidth: 100 },
|
|
35
|
-
{ id: 'finish', name: 'Finish', field: 'finish', nameKey: 'FINISH', formatter: Formatters.dateIso, minWidth: 100 },
|
|
36
|
-
{ id: 'completed', name: 'Completed', field: 'completed', nameKey: 'COMPLETED', formatter: Formatters.translate, sortable: true, minWidth: 100 }
|
|
37
|
-
// OR via your own custom translate formatter
|
|
38
|
-
// { id: 'completed', name: 'Completed', field: 'completed', nameKey: 'COMPLETED', formatter: translateFormatter, sortable: true, minWidth: 100 }
|
|
39
|
-
];
|
|
40
|
-
this.gridOptions = {
|
|
41
|
-
autoResize: {
|
|
42
|
-
containerId: 'demo-container',
|
|
43
|
-
sidePadding: 15
|
|
44
|
-
},
|
|
45
|
-
enableAutoResize: true,
|
|
46
|
-
enableTranslate: true,
|
|
47
|
-
i18n: this.translate
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
// create a custom translate Formatter
|
|
53
|
-
taskTranslateFormatter: Formatter = (row, cell, value, columnDef, dataContext) => {
|
|
54
|
-
return this.translate('TASK_X', { x: value });
|
|
55
|
-
}
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
#### Custom Formatter (cell values)
|
|
59
|
-
You can define your own custom Formatter by providing the `i18n` Service into the Formatter and using the `.tr()` function to translate the cell value.
|
|
60
|
-
```typescript
|
|
61
|
-
taskTranslateFormatter: Formatter = (row, cell, value, columnDef, dataContext) => {
|
|
62
|
-
return this.translate.instant('TASK_X', { x: value });
|
|
63
|
-
}
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
#### Filtering with Translated cell value (`translateFormatter`)
|
|
67
|
-
Since the cell value is to be translated, the regular filtering might behave differently than excepted (it will filter against a translation key instead of filtering against the formatted output which is what we want). If you want to filter against the formatted output (`translateFormatter` or even a custom formatter), you need to fill in the `i18n` property in the Grid Options and set `useFormatterOuputToFilter` to True, for more info please see [Wiki - input filter with localization](../column-functionalities/filters/input-filter.md#filtering-with-localization-i18n)
|
|
68
|
-
|
|
69
|
-
#### Using Angular-Slickgrid Formatters.Translate
|
|
70
|
-
Instead of defining a custom formatter over and over, you could also use the built-in Angular-Slickgrid `Formatters.translate`. However for the formatter to work, you need to provide the `ngx-translate` Service instance, to the Grid Options property `i18n`, as shown below.
|
|
71
|
-
|
|
72
|
-
```typescript
|
|
73
|
-
this.columnDefinitions = [
|
|
74
|
-
{
|
|
75
|
-
id: 'title',
|
|
76
|
-
name: 'Title',
|
|
77
|
-
field: 'title',
|
|
78
|
-
nameKey: 'TITLE',
|
|
79
|
-
formatter: Formatters.translate
|
|
80
|
-
}
|
|
81
|
-
];
|
|
82
|
-
|
|
83
|
-
this.gridOptions = {
|
|
84
|
-
enableTranslate: true,
|
|
85
|
-
i18n: this.translate // provide the `ngx-translate instance through the params.i18n property
|
|
86
|
-
}
|
|
87
|
-
```
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
###### Requires at least version `2.10.x`
|
|
2
|
-
|
|
3
|
-
## Description
|
|
4
|
-
Most of example that you will find across this library were made with `ngx-translate` (dynamic translation) support. However a few users of the lib only use 1 locale (English or any other locale). Since not all users requires multiple translations, as of version `2.13.0`, it is now possible to use `Angular-Slickgrid` without `ngx-translate`. What is the difference with/without `ngx-translate`? Not much, the only difference is that `ngx-translate` is now an optional dependency (thanks to Angular [@Optional Dependency](https://angular.io/guide/singleton-services), via `@Optional() TranslateService`), so if you don't provide `ngx-translate`, it will simply try to use Custom Locales, you can provide your own locales (see instruction below), or if none are provided it will use English locales by default.
|
|
5
|
-
|
|
6
|
-
## Code Sample
|
|
7
|
-
[Demo Component](https://github.com/ghiscoding/angular-slickgrid-demos/tree/master/bootstrap3-demo-with-locales/src/app/locales)
|
|
8
|
-
|
|
9
|
-
## Installation
|
|
10
|
-
There are 2 ways of using and defining Custom Locales, see below on how to achieve that.
|
|
11
|
-
|
|
12
|
-
### 1. Define your Custom Locales
|
|
13
|
-
#### English Locale
|
|
14
|
-
English is the default, if that is the locale you want to use then there's nothing to do, move along...
|
|
15
|
-
|
|
16
|
-
#### Any other Locales (not English)
|
|
17
|
-
To use any other Locales, you will need to create a TypeScript file of all the Locale Texts required for the library to work properly (if you forget to define a locale text, it will simply show up in English). For example, if we define a French Locale, it would look like this (for the complete list of required field take a look at the default [English Locale](https://github.com/ghiscoding/angular-slickgrid-demos/blob/master/bootstrap5-demo-with-locales/src/app/locales/en.ts))
|
|
18
|
-
```ts
|
|
19
|
-
// localeFrench.ts or fr.ts
|
|
20
|
-
export const localeFrench = {
|
|
21
|
-
// texte requis
|
|
22
|
-
TEXT_ALL_SELECTED: 'Tout sélectionnés',
|
|
23
|
-
TEXT_CANCEL: 'Annuler',
|
|
24
|
-
TEXT_CLEAR_ALL_FILTERS: 'Supprimer tous les filtres',
|
|
25
|
-
TEXT_CLEAR_ALL_SORTING: 'Supprimer tous les tris',
|
|
26
|
-
// ... the rest of the text
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
#### 2. Use the Custom Locales
|
|
30
|
-
##### Through the `forRoot()` (globally)
|
|
31
|
-
This will literally configure Custom Locales for the entire project, so if you want to do it once, that is the place to do it.
|
|
32
|
-
```ts
|
|
33
|
-
// app.module.ts
|
|
34
|
-
@NgModule({
|
|
35
|
-
imports: [
|
|
36
|
-
AngularSlickgridModule.forRoot({
|
|
37
|
-
// add any Global Grid Options/Config you might want
|
|
38
|
-
|
|
39
|
-
// Provide a custom locales set
|
|
40
|
-
locales: localeFrench,
|
|
41
|
-
})
|
|
42
|
-
]
|
|
43
|
-
});
|
|
44
|
-
```
|
|
45
|
-
##### Through the Grid Option of any grid
|
|
46
|
-
You can alternatively provide Custom Locales through any grid declaration through the `locales` Grid Options (it's the same as the global one, except that it's per grid)
|
|
47
|
-
|
|
48
|
-
```ts
|
|
49
|
-
import { localeFrench } from 'locales/fr';
|
|
50
|
-
|
|
51
|
-
export class MyGridComponent {
|
|
52
|
-
prepareGrid() {
|
|
53
|
-
this.columnDefinitions = [ /* ... */ ];
|
|
54
|
-
|
|
55
|
-
this.gridOptions = {
|
|
56
|
-
enableAutoResize: true,
|
|
57
|
-
|
|
58
|
-
// provide Custom Locale to this grid only
|
|
59
|
-
locales: localeFrench
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
#### 3. Use the lib (without ngx-translate)
|
|
66
|
-
There's nothing else to do, just use the library without defining or providing TranslateService and you're good to go. Read through the Wiki of the [Quick Start](../getting-started/quick-start.md) for basic grid samples.
|