Skip to content

Commit 0548c07

Browse files
Merge pull request #201 from plotly/allowDataSourceDropdownValueAndOptionCustomization
props dataSourceValueRenderer and dataSourceOptionRenderer
2 parents cac288d + f7c0cb5 commit 0548c07

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/PlotlyEditor.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ class PlotlyEditor extends Component {
3838
data: gd.data,
3939
dataSources: this.props.dataSources,
4040
dataSourceOptions: this.props.dataSourceOptions,
41+
dataSourceValueRenderer: this.props.dataSourceValueRenderer,
42+
dataSourceOptionRenderer: this.props.dataSourceOptionRenderer,
4143
dictionaries: dictionaries,
4244
fullData: gd._fullData,
4345
fullLayout: gd._fullLayout,
@@ -150,6 +152,8 @@ PlotlyEditor.propTypes = {
150152
className: PropTypes.string,
151153
dataSources: PropTypes.object,
152154
dataSourceOptions: PropTypes.array,
155+
dataSourceValueRenderer: PropTypes.func,
156+
dataSourceOptionRenderer: PropTypes.func,
153157
graphDiv: PropTypes.object,
154158
locale: PropTypes.string,
155159
revision: PropTypes.any,
@@ -170,6 +174,8 @@ PlotlyEditor.childContextTypes = {
170174
data: PropTypes.array,
171175
dataSources: PropTypes.object,
172176
dataSourceOptions: PropTypes.array,
177+
dataSourceValueRenderer: PropTypes.func,
178+
dataSourceOptionRenderer: PropTypes.func,
173179
dictionaries: PropTypes.object,
174180
fullData: PropTypes.array,
175181
fullLayout: PropTypes.object,

src/components/fields/DataSelector.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ class DataSelector extends Component {
6161
options={this.dataSourceOptions}
6262
value={this.fullValue}
6363
onChange={this.updatePlot}
64+
optionRenderer={this.context.dataSourceOptionRenderer}
65+
valueRenderer={this.context.dataSourceValueRenderer}
6466
clearable={this.props.clearable}
6567
/>
6668
</Field>
@@ -78,6 +80,8 @@ DataSelector.propTypes = {
7880
DataSelector.contextTypes = {
7981
dataSources: PropTypes.object,
8082
dataSourceOptions: PropTypes.array,
83+
dataSourceValueRenderer: PropTypes.func,
84+
dataSourceOptionRenderer: PropTypes.func,
8185
};
8286

8387
function modifyPlotProps(props, context, plotProps) {

0 commit comments

Comments
 (0)