Skip to content

Migration to 1.x

Ghislain B edited this page Nov 24, 2021 · 32 revisions

@deprecated Code (removed)

  • removed columns from Column Picker option, use visibleColumns instead.
  • removed columns from Grid Menu option, use visibleColumns instead.
  • removed findItemInHierarchicalStructure() method, use findItemInTreeStructure instead.

controls/plugins (extensions)... read below for more info

  • replace Grid Menu customItems by commandItems, see here
  • remove all images in favor of css classes, see here

Changes

SlickGrid Controls/Plugins (Extensions)

Since all SlickGrid controls/plugins were rewritten and moved into Slickgrid-Universal (prior to the new release, we were using them from SlickGrid repo and we had Extension bridges in Slickgrid-Universal but now all the code exist in Slickgrid-Universal), they were also rewritten as plain vanilla JS (basically there's no more jQuery code with exception of Draggable Grouping which still require jQueryUI).

Because of all the rewriting, it makes sense to rename the method getSlickgridAddonInstance to getExtensionInstanceByName and it now return the instance directly and it also automatically infers the correct return instance class as well.

Here's an example of the code change that you need to do

 toggleGridMenu(e: Event) {
    if (this.sgb?.extensionService) {
-     const gridMenuInstance = this.sgb.extensionService.getSlickgridAddonInstance(ExtensionName.gridMenu); // return type was `any`
+     const gridMenuInstance = this.sgb.extensionService.getExtensionInstanceByName(ExtensionName.gridMenu); // return type now infers `SlickGridMenu` instance
      gridMenuInstance.showGridMenu(e);
    }
  }

Grid Menu customItems replaced by commandItems

Replace all custom properties to command properties

  • replace customItems by commandItems
  • replace customTitle by commandTitle
  • replace customTitleKey by commandTitleKey

Images are removed in favor of CSS classes

Another change due to the rewrite, all images related code in favor of css classes.

  • removed deleteIconImage, use deleteIconCssClass instead.
  • removed groupIconImage, use groupIconCssClass instead.
  • removed buttonImage, use buttonCssClass instead.
  • removed iconImage, use iconCssClass instead
  • removed image, use cssClass instead
What if you still want images?

If you really want to use image, you can still do it but you'll have to create a css class with the following background-image: url(images/my-image.gif);

Clone this wiki locally