Skip to content

Commit

Permalink
fix(eventService): use grid.getOptions for gridDefinition
Browse files Browse the repository at this point in the history
This fixes a potential problem where the grid options as a parameter in the method are different than grid.getOptions. Users are allowed to change options after the grid is created by calling, for example, `grid.getOptions().showHeaderValue = false`;. To make sure the options are up to date we need to call `grid.getOptions` when passing it to the events. Looking over `AureliaSlickgridCustomElement`, it should be fine to use `this.gridOptions` because most of the configuration is happening when the custom element is being created. The only potential issue I could see is if the `datasetChanged` fires after the grid is created. Then any call to `this.gridOptions` could potentially be out of data if the developer allows the user to change options later on. You can see this bug in example3 when you switch `autoEdit` off click the "edit" button. The gridDefinition has `autoEdit=true`

closes #49
  • Loading branch information
jmzagorski committed Apr 19, 2018
1 parent 2bb0de7 commit e67e93a
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class GridEventService {
row: args.row,
cell: args.cell,
dataView,
gridDefinition: gridOptions,
gridDefinition: grid.getOptions(),
grid,
columnDef: column,
dataContext: args.grid.getDataItem(args.row)
Expand All @@ -49,7 +49,7 @@ export class GridEventService {
row: args.row,
cell: args.cell,
dataView,
gridDefinition: gridOptions,
gridDefinition: grid.getOptions(),
grid,
columnDef: column,
dataContext: args.grid.getDataItem(args.row)
Expand Down

0 comments on commit e67e93a

Please sign in to comment.