You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2021/02/10 07:41:25 UTC

[GitHub] [superset] ktmud commented on a change in pull request #13029: fix(explore): Enable selecting an option not included in suggestions

ktmud commented on a change in pull request #13029:
URL: https://github.com/apache/superset/pull/13029#discussion_r573507256



##########
File path: superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterEditPopoverSimpleTabContent.jsx
##########
@@ -379,12 +386,25 @@ export default class AdhocFilterEditPopoverSimpleTabContent extends React.Compon
               name="filter-value"
               {...comparatorSelectProps}
               getPopupContainer={triggerNode => triggerNode.parentNode}
+              onSearch={val => this.setState({ currentSuggestionSearch: val })}
+              onSelect={this.clearSuggestionSearch}
+              onBlur={this.clearSuggestionSearch}
             >
               {this.state.suggestions.map(suggestion => (
                 <Select.Option value={suggestion} key={suggestion}>
                   {suggestion}
                 </Select.Option>
               ))}
+
+              {/* enable selecting an option not included in suggestions */}
+              {currentSuggestionSearch &&
+                !this.state.suggestions.some(
+                  suggestion => suggestion === currentSuggestionSearch,
+                ) && (
+                  <Select.Option value={currentSuggestionSearch}>
+                    {currentSuggestionSearch}
+                  </Select.Option>
+                )}

Review comment:
       You probably don't need this since AntD select [has a "tags" mode](https://ant.design/components/select/#components-select-demo-tags), which behave similar to a freeForm react-select (`CreatableSelect`).




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org