-
Notifications
You must be signed in to change notification settings - Fork 424
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
Allow overriding of SlickGrid options #23
Conversation
|
||
class SlickGrid(object): | ||
|
||
def __init__(self, data_frame, remote_js=False): | ||
def __init__(self, data_frame, remote_js=False, precision=None, | ||
options={}): |
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.
This shouldn't be a dict: see http://docs.python-guide.org/en/latest/writing/gotchas/#mutable-default-arguments
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.
Thanks, while I agree that this is a common gotcha, in this case I had thought about it and concluded it's fine. options
is only read later (in self.options.update(options)
) and not modified, hence I don't believe your concern is an issue here. I thought that this usage is more self-documenting than the standard approach of options=None
and then later:
if options is None:
options = {}
I'm happy to change it to the latter though if you are concerned but I don't think it's necessary.
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.
@snth this looks awesome...such a useful change. Once you address Scott's comment I'll be happy to merge it. |
@TimShawver if you're happy with the functionality here we can merge and iterate on the specific implementation. |
@TimShawver @snth I made a secondary PR on top of this one at #24. I think it's the right way forward, but I'd like to get your guys' feedback. |
Signed-off-by: Richard Lin <richard.lin.047@berkeley.edu>
Signed-off-by: Richard Lin <richard.lin.047@berkeley.edu>
Signed-off-by: Richard Lin <richard.lin.047@berkeley.edu>
Signed-off-by: Richard Lin <richard.lin.047@berkeley.edu>
…pian#33) Signed-off-by: Richard Lin <richard.lin.047@berkeley.edu>
I wanted a way to override the forceFitColumns parameter and this PR works for me.
Example usage: