-
-
Notifications
You must be signed in to change notification settings - Fork 19
Migration to 3.x
Before you start, make sure that you don't have any console log warnings (most of the deprecated code from 2.x
are already displaying console warnings to advise you of what's being removed). It will be easier to fix console warnings first, then move on to the list of changes below.
- Export to File & Export to Excel are now decoupled and opt-in (see Export Services)
- Backend Service APIs are now decoupled and opt-in (see Backend Service API)
- Remove event name prefixes
asg
,sg
(in other wordsasg-on-aurelia-grid-created
becomeson-aurelia-grid-created
)- You can however put the prefixes back (see Grid Events)
- Styling (css/sass) main files are now under the
@slickgrid-universal/common
monorepo (see Stylings)
note: most of the deprecated code should already send you console warnings, so first check your console.
- removed all Grid Service methods having the word "toDatagrid" in their names
- for example,
addItemToDatagrid
,deleteDataGridItem
, ... - simply use the newer methods (named as
addItem
,deleteItemById
,updateItem
, ...), which have a lot more features and options.
- for example,
- removed
registerPlugins
Grid Option since all useful plugins/controls already exist in the lib. - removed
hideColumn(column)
please usehideColumnById
orhideColumnByIds
instead - removed
hideColumnByIndex(idx)
please usehideColumnById
orhideColumnByIds
instead - removed
BackendServiceOption
property namedcolumnDefinitions
, this is no longer a valid property which means that you cannot use it anymore with OData/GraphQL. This is no longer necessary since the Services can get the columns definition directly from the grid object. - removed SASS variables
$large-editor-textarea-height
$large-editor-textarea-width
The 3rd party lib named multiple-select.js
is no longer included within Aurelia-Slickgrid, it is now a separate npm package named multiple-select-modified
You might have referenced this library in your main.ts
or index.html
, you will need to adjust the path to the library
# main.ts
- import 'aurelia-slickgrid/dist/lib/multiple-select/multiple-select.css';
- import 'aurelia-slickgrid/dist/lib/multiple-select/multiple-select.js';
+ import 'multiple-select-modified/src/multiple-select.css';
+ import 'multiple-select-modified/src/multiple-select.js';
or in the View (with RequireJS)
- <link rel="stylesheet" type="text/css" href="../node_modules/aurelia-slickgrid/dist/lib/multiple-select/multiple-select.css">
+ <link rel="stylesheet" type="text/css" href="../node_modules/multiple-select-modified/src/multiple-select.css">
- renamed
CheckboxSelector
interface toCheckboxSelectorOption
- renamed
EditorValidatorOutput
interface toEditorValidationResult
- renamed
Sorter
interface toSortComparer
- renamed
Sorters
toSortComparers
(often used when using the Grouping feature)
Note that the BackendServiceApi
is no longer exposed in the AureliaGridInstance
, so if you wish to reference it (for example when you want to use it with an external export button), then create a reference while instantiating it or get it via the grid option this.gridOptions.backendServiceApi.service
-
headerKey
was replaced bynameKey
(to align with SlickGridname
property when using I18N with translations)
Changed grid events prefixes Aurelia-Slickgrid (asg
) and SlickGrid (sg
).
However please note that you can always add them back to avoid having to refactor all your grids at once, the main changes is in the global grid options:
export const GlobalGridOptions: Partial<GridOption> = {
- defaultAureliaEventPrefix: 'asg',
- defaultSlickgridEventPrefix: 'sg',
+ defaultAureliaEventPrefix: '',
+ defaultSlickgridEventPrefix: '',
+ eventNamingStyle: EventNamingStyle.kebabCase,
}
So if you wish to keep asg
and sg
prefixes, then just add back the following in your grid options:
this.gridOptions = {
defaultAureliaEventPrefix: 'asg',
defaultSlickgridEventPrefix: 'sg',
// ...
}
You might have notice the eventNamingStyle
grid option, it is indeed a new option and with it you can change the names of the events following a defined naming convention. The default is kebab case (separated by hyphens) but you could also use the lower case option (which is an acceptable ES6 syntax), if you take that for example that would become:
So the default is kebab case event naming:
<aurelia-slickgrid on-click.delegate="handleOnClick($event.detail)">
But if you wish to use all lower case, you can do change the grid option
this.gridOptions {
+ eventNamingStyle: EventNamingStyle.lowerCase,
}
That would result in all lower case names
<aurelia-slickgrid
- on-click.delegate="handleOnClick($event.detail)">
+ onclick.delegate="handleOnClick($event.detail)">
Again note that all the documentation is written with event names following the default kebab case format (on-click
).
- Grid Height/Width should now be passed through the Grid Options instead of the View, for example:
<aurelia-slickgrid grid-id="grid1" column-definitions.bind="columnDefinitions" grid-options.bind="gridOptions" dataset.bind="dataset"
- grid-height="225"
- grid-width="800">
</aurelia-slickgrid>
was moved to the Grid Options in the ViewModel
this.gridOptions = {
+ gridHeight: 225,
+ gridWidth: 800
};
- renamed
hideFilterCommands
to singularhideFilterCommand
since there can only be 1 filter per column
The CSS/SASS Stylings now come from the @slickgrid-universal/common
monorepo package, you need to adjust your imports
# with CSS (main.ts)
- import 'aurelia-slickgrid/dist/styles/css/slickgrid-theme-bootstrap.css';
+ import '@slickgrid-universal/common/dist/styles/css/slickgrid-theme-bootstrap.css';
# with SASS
- @import 'aurelia-slickgrid/dist/styles/sass/slickgrid-theme-bootstrap.scss';
+ @import '@slickgrid-universal/common/dist/styles/sass/slickgrid-theme-bootstrap.scss';
-
updateItem()
will no longer highlight the row by default (if you want to get this behavior back then pass optionhighlightRow: true
)
The GridOdataService
is now an opt-in Service and is no longer exposed in the AureliaGridInstance
, you need create a reference while instantiating it or get it via the grid option this.gridOptions.backendServiceApi.service
- import { GridOdataService, OdataServiceApi, OdataOption } from 'aurelia-slickgrid';
+ import { GridOdataService, OdataServiceApi, OdataOption } from '@slickgrid-universal/odata';
export class MyExample {
prepareGrid {
this.columnDefinitions = [ /*...*/ ];
this.gridOptions = {
backendServiceApi: {
service: new GridOdataService(),
options: { /*...*/ } as OdataServiceApi
}
}
}
The GraphqlService
is now an opt-in Service and is no longer exposed in the AureliaGridInstance
, you need create a reference while instantiating it or get it via the grid option this.gridOptions.backendServiceApi.service
- import { GraphqlService, GraphqlPaginatedResult, GraphqlServiceApi, } from 'aurelia-slickgrid';
+ import { GraphqlService, GraphqlPaginatedResult, GraphqlServiceApi, } from '@slickgrid-universal/graphql';
export class MyExample {
prepareGrid {
this.columnDefinitions = [ /*...*/ ];
this.gridOptions = {
backendServiceApi: {
service: new GraphqlService(),
options: { /*...*/ } as GraphqlServiceApi
}
}
}
Export Service was renamed to TextExportService
(export extensions are .txt
, .csv
) and is now an opt-in Servicem it is also no longer exposed in the AureliaGridInstance
. You need to use the new @slickgrid-universal/text-export
packages and register the service(s) in your grid options as shown below.
Also note that Text Export Service grid options changed as well, a few options got deprecated and renamed to have the word "textExport" instead of just "export". Also to be clear, it's deprecated but still exist, this will give you time to refactor your code. Here's the list
- deprecate
exportOptions
and renamed totextExportOptions
- deprecate
enableExport
flag and renamed toenableTextExport
- the onBefore/onAfter events got renamed as well to
onBeforeExportToTextFile
andonAfterExportToTextFile
- in the View that would equal to
asg-on-before-export-to-text-file
andasg-on-after-export-to-text-file
- in the View that would equal to
import { Column, GridOption } from 'aurelia-slickgrid';
+ import { ExcelExportService } from '@slickgrid-universal/excel-export';
+ import { TextExportService } from '@slickgrid-universal/text-export';
export class MyExample {
prepareGrid {
this.columnDefinitions = [ /*...*/ ];
this.gridOptions = {
enableExcelExport: true,
excelExportOptions: { sanitizeDataExport: true },
- enableExport: true,
- exportOptions: { sanitizeDataExport: true },
+ enableTextExport: true,
+ textExportOptions: { sanitizeDataExport: true },
// add 2x Export Services (you can add a single or both export services, it should always be an array
+ registerExternalServices: [new ExcelExportService(), new TextExportService()],
}
}
}
The ExcelExportService
is also an opt-in Service and is no longer exposed in the AureliaGridInstance
, so if you wish to reference it (for example when you want to use it with an external export button), then create a reference while instantiating it (the excelExportOptions
are the same as before).
import { Column, GridOption } from 'aurelia-slickgrid';
+ import { ExcelExportService } from '@slickgrid-universal/excel-export';
export class MyExample {
+ excelExportService = new ExcelExportService(); // create a variable ref when you need to access it later
prepareGrid {
this.columnDefinitions = [ /*...*/ ];
this.gridOptions = {
enableExcelExport: true,
excelExportOptions: { sanitizeDataExport: true },
+ registerExternalServices: [this.excelExportService],
}
}
exportToExcel() {
- this.aureliaGrid.excelExportService.exportToExcel({ filename: 'Export', format: FileType.xlsx });
+ this.excelExportService.exportToExcel({ filename: 'export', format: FileType.xlsx });
}
}
Contents
- Aurelia-Slickgrid Wiki
- Installation
- Styling
- Interfaces/Models
- Testing Patterns
- Column Functionalities
- Global Grid Options
- Localization
- Events
- Grid Functionalities
- Auto-Resize / Resizer Service
- Resize by Cell Content
- Add/Delete/Update or Highlight item
- Dynamically Change Row CSS Classes
- Column Picker
- Composite Editor Modal
- Context Menu
- Custom Tooltip
- Excel Copy Buffer
- Export to Excel
- Export to File (CSV/Txt)
- Grid Menu
- Grid State & Presets
- Grouping & Aggregators
- Header Menu & Header Buttons
- Header Title Grouping
- Pinning (frozen) of Columns/Rows
- Row Colspan
- Row Detail
- Row Selection
- Tree Data Grid
- SlickGrid & DataView objects
- Addons (controls/plugins)
- Backend Services