[Canvas] Fix falsey/null value bug for dropdown choices (#69290)
* Fixed falsey/null value bug for dropdown choices * Filter only null and undefined values Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This commit is contained in:
parent
5b5aa70df7
commit
21af99c9b9
1 changed files with 6 additions and 2 deletions
|
@ -52,8 +52,12 @@ export function dropdownControl(): ExpressionFunctionDefinition<
|
|||
fn: (input, { valueColumn, filterColumn, filterGroup }) => {
|
||||
let choices = [];
|
||||
|
||||
if (input.rows[0][valueColumn]) {
|
||||
choices = uniq(input.rows.map((row) => row[valueColumn])).sort();
|
||||
const filteredRows = input.rows.filter(
|
||||
(row) => row[valueColumn] !== null && row[valueColumn] !== undefined
|
||||
);
|
||||
|
||||
if (filteredRows.length > 0) {
|
||||
choices = uniq(filteredRows.map((row) => row[valueColumn])).sort();
|
||||
}
|
||||
|
||||
const column = filterColumn || valueColumn;
|
||||
|
|
Loading…
Reference in a new issue