I was curious if it’s possible to render the multiple options based on the filtered out results. Currently, the options are rendered from all the possible column options that were received from the data source’s query. I.E. you pick just one option from the first query based parameter input and the next query based parameter input has available options that none of the first query based parameter input’s selection includes in the data. What we would want to do is filter out those options in the second query based parameter input depending on the data that was filtered out using the first query based parameter input.
Since It appears most of the frontend state is defined in the component itself I’m a bit stumped on how we can pass in the data we have in our visualization as a prop to those QueryBaseParameterInput.jsx
components. We were able to get the result of the filtered out data in the filterData
function in Filters.jsx
but couldn’t see any state changes in the filters array besides it being an empty array.
How we would want to pass the results:
renderQueryBasedInput() {
const { queryId, parameter, filteredResults } = this.props;
return (
<QueryBasedParameterInput
// Pass filtered out results as a prop
results={filteredResults}
/>
);
}
and then filter out the options in the select like:
render() {
const { results } = this.props;
return (
<AntdSelect<string>
// Antd Select filterOption prop that allows us to filter out the options
filterOption={ (option) => results.includes(option) }
/>
);
}
Something else I looked into was the useQueryResultData()
hook but I didn’t know how to pass the query needed from the QueryBaseParameterInput.jsx
nor SelectWithVirutualScroll.tsx
components like it shows in VisualizationRenderer.jsx
as:
const data = useQueryResultData(props.queryResult);