-
diff --git a/packages/vanilla-bundle-examples/src/examples/example04.scss b/packages/vanilla-bundle-examples/src/examples/example03.scss
similarity index 100%
rename from packages/vanilla-bundle-examples/src/examples/example04.scss
rename to packages/vanilla-bundle-examples/src/examples/example03.scss
diff --git a/packages/vanilla-bundle-examples/src/examples/example04.ts b/packages/vanilla-bundle-examples/src/examples/example03.ts
similarity index 81%
rename from packages/vanilla-bundle-examples/src/examples/example04.ts
rename to packages/vanilla-bundle-examples/src/examples/example03.ts
index 6638944b9..07e0f022d 100644
--- a/packages/vanilla-bundle-examples/src/examples/example04.ts
+++ b/packages/vanilla-bundle-examples/src/examples/example03.ts
@@ -1,10 +1,8 @@
import { Column, GridOption } from '@slickgrid-universal/common';
import { Slicker } from '@slickgrid-universal/vanilla-bundle';
-import './example04.scss';
+import './example03.scss';
export class Example4 {
- gridClass;
- gridClassName;
_commandQueue = [];
columnDefinitions: Column[];
gridOptions: GridOption;
@@ -22,7 +20,7 @@ export class Example4 {
attached() {
this.initializeGrid();
this.dataset = [];
- const gridContainerElm = document.querySelector('.grid3');
+ const gridContainerElm = document.querySelector('.grid4');
const gridElm = document.querySelector('.slickgrid-container');
gridContainerElm.addEventListener('onclick', this.handleOnClick.bind(this));
@@ -36,7 +34,6 @@ export class Example4 {
this.dataViewObj.setFilter(this.myFilter.bind(this));
this.dataset = this.mockDataset();
this.slickgridLwc.dataset = this.dataset;
-
}
initializeGrid() {
@@ -58,20 +55,6 @@ export class Example4 {
},
enableAutoSizeColumns: true,
enableAutoResize: true,
- // enableCellNavigation: true,
- enableGrouping: true,
- enableRowSelection: true,
- // enableCheckboxSelector: true,
- formatterOptions: {
- minDecimal: 0,
- maxDecimal: 2,
- thousandSeparator: ','
- },
- rowSelectionOptions: {
- selectActiveRow: false // False for Multiple Selections
- },
- sanitizer: (dirtyHtml) => (dirtyHtml.replace(/(\b)(on\S+)(\s*)=|javascript|(<\s*)(\/*)script/gi, '')),
- enableSorting: true,
headerRowHeight: 45,
rowHeight: 45,
editCommandHandler: (item, column, editCommand) => {
@@ -131,60 +114,6 @@ export class Example4 {
return true;
}
- customBlankFormatter() {
- return '';
- }
-
- customAceGroupingFormatter(totals, columnDef) {
- const hasAce = totals.clone && totals.clone[columnDef.field];
- return !hasAce ? '' : '
';
- }
-
- customCheckmarGroupingFormatter(totals, columnDef) {
- const hasCheckmark = totals.clone && totals.clone[columnDef.field];
- return !hasCheckmark ? '' : '
';
- }
-
- customQuantityGroupingFormatter(totals, columnDef) {
- return totals.min && totals.min[columnDef.field] || '';
- }
-
- customLineTypeGroupingFormatter(totals, columnDef) {
- const val = totals.clone && totals.clone[columnDef.field];
- let output = '';
- switch (val) {
- case 'Profiled':
- output = `
`;
- break;
- case 'Selector':
- output = `
`;
- break;
- default:
- output = '';
- break;
- }
- return output;
- }
-
- customTranslationTypeGroupingFormatter(totals, columnDef) {
- const val = totals.clone && totals.clone[columnDef.field];
- let output = '';
- switch (val) {
- case 'Drawing':
- output = `
`;
- break;
- default:
- output = '';
- break;
- }
- return output;
- }
-
- customProductGroupingFormatter(totals, columnDef) {
- const val = totals.clone && totals.clone['productGroup'];
- return val ? `
${val}` : '';
- }
-
addNewRow() {
const id = this.dataset.length;
const newIndent = 1;
diff --git a/packages/vanilla-bundle/src/vanilla-grid-bundle.ts b/packages/vanilla-bundle/src/vanilla-grid-bundle.ts
index 605fc1c1f..36e77377c 100644
--- a/packages/vanilla-bundle/src/vanilla-grid-bundle.ts
+++ b/packages/vanilla-bundle/src/vanilla-grid-bundle.ts
@@ -122,9 +122,9 @@ export class VanillaGridBundle {
this.refreshGridData(dataset);
}
- constructor(gridContainerElm: Element, columnDefs: Column[], options: GridOption, dataset?: any[]) {
- this._columnDefinitions = columnDefs;
- this._gridOptions = options;
+ constructor(gridContainerElm: Element, columnDefs?: Column[], options?: GridOption, dataset?: any[]) {
+ this._columnDefinitions = columnDefs || [];
+ this._gridOptions = options || {};
this.dataset = dataset || [];
this._eventPubSubService = new EventPubSubService(gridContainerElm);
@@ -174,7 +174,7 @@ export class VanillaGridBundle {
dispose() {
this.dataView = undefined;
- this.gridOptions = {};
+ this._gridOptions = {};
this.extensionService.dispose();
this.filterService.dispose();
// this.gridEventService.dispose();
@@ -200,7 +200,7 @@ export class VanillaGridBundle {
gridContainerElm.appendChild(this._gridElm);
this._gridOptions = this.mergeGridOptions(this._gridOptions);
- this.backendServiceApi = this.gridOptions && this.gridOptions.backendServiceApi;
+ this.backendServiceApi = this._gridOptions && this._gridOptions.backendServiceApi;
this._isLocalGrid = !this.backendServiceApi; // considered a local grid if it doesn't have a backend service set
this._eventPubSubService.eventNamingStyle = this._gridOptions && this._gridOptions.eventNamingStyle || EventNamingStyle.camelCase;
this._eventHandler = new Slick.EventHandler();
@@ -244,7 +244,7 @@ export class VanillaGridBundle {
this.gridService.init(this.grid, this.dataView);
if (this._dataset.length > 0) {
- // if (!this._isDatasetInitialized && (this.gridOptions.enableCheckboxSelector || this.gridOptions.enableRowSelection)) {
+ // if (!this._isDatasetInitialized && (this._gridOptions.enableCheckboxSelector || this._gridOptions.enableRowSelection)) {
// this.loadRowSelectionPresetWhenExists();
// }
this._isDatasetInitialized = true;
@@ -269,7 +269,7 @@ export class VanillaGridBundle {
slickGrid: this.grid,
// return all available Services (non-singleton)
- backendService: this.gridOptions && this.gridOptions.backendServiceApi && this.gridOptions.backendServiceApi.service,
+ backendService: this._gridOptions && this._gridOptions.backendServiceApi && this._gridOptions.backendServiceApi.service,
// excelExportService: this.excelExportService,
// exportService: this.exportService,
filterService: this.filterService,
@@ -280,7 +280,7 @@ export class VanillaGridBundle {
extensionService: this.extensionService,
// paginationService: this.paginationService,
sortService: this.sortService,
- }
+ };
this._eventPubSubService.publish('onSlickerGridCreated', slickerElementInstance);
}
@@ -406,7 +406,7 @@ export class VanillaGridBundle {
// local grid, check if we need to show the Pagination
// if so then also check if there's any presets and finally initialize the PaginationService
// a local grid with Pagination presets will potentially have a different total of items, we'll need to get it from the DataView and update our total
- // if (this.gridOptions && this.gridOptions.enablePagination && this._isLocalGrid) {
+ // if (this._gridOptions && this._gridOptions.enablePagination && this._isLocalGrid) {
// this.showPagination = true;
// this.loadLocalGridPagination(dataset);
// }
@@ -418,7 +418,7 @@ export class VanillaGridBundle {
}
if (dataset.length > 0) {
- // if (!this._isDatasetInitialized && this.gridOptions.enableCheckboxSelector) {
+ // if (!this._isDatasetInitialized && this._gridOptions.enableCheckboxSelector) {
// this.loadRowSelectionPresetWhenExists();
// }
this._isDatasetInitialized = true;
@@ -430,14 +430,14 @@ export class VanillaGridBundle {
}
// display the Pagination component only after calling this refresh data first, we call it here so that if we preset pagination page number it will be shown correctly
- // this.showPagination = (this.gridOptions && (this.gridOptions.enablePagination || (this.gridOptions.backendServiceApi && this.gridOptions.enablePagination === undefined))) ? true : false;
+ // this.showPagination = (this._gridOptions && (this._gridOptions.enablePagination || (this._gridOptions.backendServiceApi && this._gridOptions.enablePagination === undefined))) ? true : false;
- // if (this.gridOptions && this.gridOptions.backendServiceApi && this.gridOptions.pagination && this.paginationOptions) {
- // const paginationOptions = this.setPaginationOptionsWhenPresetDefined(this.gridOptions, this.paginationOptions);
+ // if (this._gridOptions && this._gridOptions.backendServiceApi && this._gridOptions.pagination && this.paginationOptions) {
+ // const paginationOptions = this.setPaginationOptionsWhenPresetDefined(this._gridOptions, this.paginationOptions);
// // when we have a totalCount use it, else we'll take it from the pagination object
// // only update the total items if it's different to avoid refreshing the UI
- // const totalRecords = (totalCount !== undefined) ? totalCount : (this.gridOptions && this.gridOptions.pagination && this.gridOptions.pagination.totalItems);
+ // const totalRecords = (totalCount !== undefined) ? totalCount : (this._gridOptions && this._gridOptions.pagination && this._gridOptions.pagination.totalItems);
// if (totalRecords !== undefined && totalRecords !== this.totalItems) {
// this.totalItems = +totalRecords;
// }
@@ -465,7 +465,6 @@ export class VanillaGridBundle {
*/
updateColumnDefinitionsList(newColumnDefinitions: Column[]) {
// map/swap the internal library Editor to the SlickGrid Editor factory
- // console.log('newColumnDefinitions', newColumnDefinitions)
newColumnDefinitions = this.swapInternalEditorToSlickGridFactoryEditor(newColumnDefinitions);
if (this._gridOptions.enableTranslate) {
this.extensionService.translateColumnHeaders(false, newColumnDefinitions);