Hi, just noticed a small issue with dcc.Checklist. When I don't put values, I get a "Error in Layout". However, putting an empty array of values works.
For example this works,
checklist = dcc.Checklist( options=[
{'label': 'New York City0', 'value': 'NYC0' },
{'label': 'New York City1', 'value': 'NYC1' },
{'label': 'New York City2', 'value': 'NYC2' },
{'label': 'New York City3', 'value': 'NYC3' }
],
values=[] ,#['NYC0', 'NYC1'],
labelStyle={'display':'inline-block'} )
this does not,
checklist = dcc.Checklist( options=[
{'label': 'New York City0', 'value': 'NYC0' },
{'label': 'New York City1', 'value': 'NYC1' },
{'label': 'New York City2', 'value': 'NYC2' },
{'label': 'New York City3', 'value': 'NYC3' }
],
labelStyle={'display':'inline-block'} )
Hey! I'd like to take this up. Where exactly is the dcc.Checklist defined?
New here, any help and guidance would be appreciated!
@chriddyp Just adding Values to the defaultProps should work right?
@shreyasbapat I'm not sure if the above PR solves that issue. I think the bug is that putting an empty list _does not_ report "Error in Layout". Because as per the inline comments in Checklist.propTypes at dash-core-components/src/components/Checklist.react.js
/**
* The value of the checkbox. This value
* corresponds to the items specified in the
* `values` property.
*/
value: PropTypes.string,
From what I understand, every entry specified by the value attribute should be one of the entries in values. In which case, passing an empty list to values is still an error. If not then the inline comment needs to be changed.
@chriddyp can you please clarify?
I think the bug is that putting an empty list does not report "Error in Layout"
No, values=[] should mean that "no checkbox is selected".
I believe that values=[] as defaultProps should indeed fix the issue.
Most helpful comment
No,
values=[]should mean that "no checkbox is selected".I believe that
values=[]asdefaultPropsshould indeed fix the issue.