Migration Guide to 2.x
Services
Angular-Slickgrid Services are no longer Singleton and are no longer available as Dependency Injection (DI) anymore, they are instead available in the Angular Grid Instance that can be obtained by the
onAngularGridCreated
Event Emitter (see below)this is the biggest change, so please make sure to review the code sample below
Event Emitter
(onGridStateServiceChanged)
renamed to(onGridStateChanged)
GridExtraUtil
no longer exist, it was containing only 1 functiongetColumnDefinitionAndData()
that got moved into theGridService
and renamed togetColumnFromEventArguments
Slick Grid & DataView objects
The Event Emitters (onGridCreated)
and (onDataviewCreated)
still exists but it is now much easier to get the Slick Grid & DataView objects directly from the (onAngularGridCreated)
Event Emitter (it's an all in 1 emitter that includes Slick objects and Angular-Slickgrid Services)
see below
Column Definitions
Column Definition
onCellClick
andonCellChange
function signatures changed to be more in line with SlickGrid subscribed events and also to provide a way to stop event bubbling if user needs thatboth functions now have 2 arguments e.g.:
onCellChange?: (e: Event, args: OnEventArgs) => void;
, see full example below
all the Editors options were previously passed through the generic
params
property. However this which removes the benefit of intellisense (VScode) and TypeScript Type check, so all of these options got moved into theeditor
options (see below)
Grid Options
For consistencies, all Grid Menu and Header Menu
showX
flags were renamed tohideX
to align with some of the SlickGridhideX
(see below)exportWithFormatter
is no longer available directly in the Grid Options, it is now underexportOptions
Grid Options (see below)i18n
is now a Grid Options which is easier to deal with instead of using the genericparams
(see below)
Editors
all the Editors options were previously passed through the generic
params
property. However this was removing the benefit of intellisense (VScode) and TypeScript Type checking. We moved all of these options into theeditor
that is now a complex objectthe Grid Option
editor
is now a complex object with the same structure as thefilter
Grid Option. This also mean that all the arguments that were previously passed to the genericparams
are now passed in theeditor
withmodel
propertythis also brings TypeScript types and intellisense to
collection
,collectionFilterBy
andcollectionSortBy
Custom Editor is now also supported
see code change below
Filters
Select Filter (
FilterType.select
) withselectOptions
got renamed tocollection
previously we had
searchTerms
(array) andsearchTerm
(singular), but the lattersearchTerm
was dropped in favor of using onlysearchTerms
to remove duplicate logic code.FilterType
got removed and you can now use directlyFilters
, also to emphasis the change we renamed thefilter
propertytype
tomodel
see example below
Backend Service API
For
BackendServiceApi
, theservice
property now as to contain anew
instance of the Backend Service that you want to use (GraphqlService
orGridOdataService
). See explanation belowAll 3
onX
service methods were renamed toprocessOnX
to remove confusion withonX
Event Emitters with the same names. (see below)this will probably not concern you, unless you built your own custom Backend Service API
BackendService
methodinitOptions
got removed and replaced byinit
which has a different argument signature
@deprecated code removed
removed
onBackendEventApi
which was replaced bybackendServiceApi
removed Select Filter
selectOptions
, replaced bycollection
removed
FormElementType
which was replaced byFilterType
removed
initOptions
function frombackendServiceApi
, which was replaced byinit
with a different signatureremove
GridExtraUtil
Service
Code Refactoring Samples & Other Explanations
onAngularGridCreated
instance
onAngularGridCreated
instanceThis new instance will contain all the Angular-Slickgrid Services (that were previously available as DI). As you can see below, you simply need to remove all DI and get a reference of the service you want through the AngularGridInstance
AngularGridInstance
interface
Note:
GridExtraService
is now exported asGridService
GroupingAndColspanService
is now exported asGroupingService
ControlAndPluginService
is now exported asPluginService
code change
View
Backend Service API - service with new
new
exportWithFormatter
flag
exportWithFormatter
flagPreviously available directly in the grid options but is now accessible only from the exportOptions
property. Also worth to know that the exportOptions
contains much more options, you can see the exportOptions
interface here.
i18n
now directly in Grid Options
i18n
now directly in Grid Optionseditor
new structure
editor
new structurefilter
new structure
filter
new structureselectOptions
renamed tocollection
FilterType
replaced byFilters
type
renamed tomodel
searchTerm
removed in favor of an array ofsearchTerms
Custom Filter is now much simpler, just pass a new instance of your class
Column Definition Events
onCellChange
and onCellClick
now expose Event as the 1st argument to be in line with SlickGrid subscribed event
Grid Menu showX
renamed to hideX
showX
renamed to hideX
Since these flags are now inverse, please do not forget to also inverse your boolean
value.
Here is the entire list of Grid Menu
showClearAllFiltersCommand
renamed tohideClearAllFiltersCommand
showClearAllSortingCommand
renamed tohideClearAllSortingCommand
showExportCsvCommand
renamed tohideExportCsvCommand
showExportTextDelimitedCommand
renamed tohideExportTextDelimitedCommand
showRefreshDatasetCommand
renamed tohideRefreshDatasetCommand
showToggleFilterCommand
renamed tohideToggleFilterCommand
and here is the list for Header Menu showColumnHideCommand
showColumnHideCommand
renamed tohideColumnHideCommand
showSortCommands
renamed tohideSortCommands
Backend Service onX
methods renamed to processOnX
onX
methods renamed to processOnX
Here is the entire list
onFilterChanged
was renamed toprocessOnFilterChanged
onPaginationChanged
was renamed toprocessOnPaginationChanged
onSortChanged
was renamed toprocessOnSortChanged
Last updated