Improve options inline searching

This commit is contained in:
Andrew Kingston 2023-10-12 14:30:41 +01:00
parent 2ef2d07cab
commit cfdaa3564c
1 changed files with 8 additions and 13 deletions

View File

@ -16,26 +16,21 @@ export const createActions = context => {
const addInlineFilter = (column, value) => { const addInlineFilter = (column, value) => {
const filterId = `inline-${column}` const filterId = `inline-${column}`
const type = column.schema.type
let inlineFilter = { let inlineFilter = {
field: column.name, field: column.name,
id: filterId, id: filterId,
operator: "equal", operator: "string",
type: column.schema.type,
valueType: "value", valueType: "value",
type,
value, value,
} }
// Add overrides specific so the certain column type // Add overrides specific so the certain column type
switch (column.schema.type) { if (type === "number") {
case "string":
case "formula":
case "longform":
inlineFilter.operator = "string"
break
case "number":
inlineFilter.value = parseFloat(value) inlineFilter.value = parseFloat(value)
break inlineFilter.operator = "equal"
case "array": } else if (type === "array") {
inlineFilter.operator = "contains" inlineFilter.operator = "contains"
} }