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 2020/05/18 18:42:01 UTC

[GitHub] [incubator-superset] ktmud commented on a change in pull request #9829: fix: [filter_box] fix 2 issues in single value filter_box

ktmud commented on a change in pull request #9829:
URL: https://github.com/apache/incubator-superset/pull/9829#discussion_r426823293



##########
File path: superset-frontend/src/explore/components/controls/FilterBoxItemControl.jsx
##########
@@ -60,7 +63,35 @@ export default class FilterBoxItemControl extends React.Component {
     this.props.onChange(this.state);
   }
   onControlChange(attr, value) {
-    this.setState({ [attr]: value }, this.onChange);
+    let typedValue = value;
+    const { column: selectedColumnName, multiple } = this.state;
+    if (value && !multiple && attr === 'defaultValue') {
+      // if single value filter_box,
+      // convert input value string to the column's data type
+      const { datasource } = this.props;
+      const selectedColumn = (
+        datasource.columns.filter(
+          col => col.column_name === selectedColumnName,
+        ) || []
+      ).pop();

Review comment:
       ```js
   selectedColumn = datasource.columns.find(x => x.column_name === selectedColumnName);
   ```




----------------------------------------------------------------
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