New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(services): remove gridOptions and columnDefinitions #55
Conversation
- removed all references from all init/attach Services
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think it is good to reduce the number of parameters since most of them can be retrieved from slickgrid. This may help with multiple grids if the consumer of the service remembers to call init
every time a method on that service is called to ensure the service has the correct grid (which could be cumbersome at first, but I think that is fine for a first iteration)
My last thought on this is storing the the grid options in _gridOptions
on init
. It could be possible that something changes the grid options from the time init
is called and the time the next method is called, which would make the _gridOptions
out of date. The only way to ensure you have the most current grid options is to call getOptions
at the point you need the options.
In that case, would you mind pulling the branch and adding the |
this way the gridOptions will always be current in case the options are changed between `init` and the time any other method is called on the service. not sure how often or if this will happen, but it protects us against it
I commit the changes to the services, see if it works for you. All i did was move the The test i ran (not shown in the code) was to set a timeout in example11 that changes the |
Oh wow ok, it's more than 1 line of code, I'm ok with the changes but I would like to test all examples before merging it. I'll do that in the coming days. |
I left some comments because I'm at work and I'm trying to apply the changes to my Angular-Slickgrid as well. I also saw that the new getter private get _gridOptions(): GridOption {
return (this._grid && this._grid.getOptions) ? this._grid.getOptions() : {};
} is not applied to all Services but it probably should be. So far I see these Services missing it
@jmzagorski EDIT @jmzagorski |
sorry just saw this. Looks good! |
Note it does not include the refactoring of
gridEventService.attachOnCellChange
andgridEventService.attachOnClick
since that was already done in a separate PR #51@jmzagorski
It's a long time that I wanted to cleanup these arguments and only use
grid
anddataView
objects. We can getoptions
andcolumnDefinitions
from thegrid
and so we should do that everywhere.I tested all the grids with all features and everything seems to work as usual.
Hopefully this will help in issue #36 (multiple grids in one view)
Note, this PR has to be merged only after PR #51 , hopefully without conflicts afterward but it's possible and will address at that time if that happens.