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,27 +16,22 @@ 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": inlineFilter.value = parseFloat(value)
case "formula": inlineFilter.operator = "equal"
case "longform": } else if (type === "array") {
inlineFilter.operator = "string" inlineFilter.operator = "contains"
break
case "number":
inlineFilter.value = parseFloat(value)
break
case "array":
inlineFilter.operator = "contains"
} }
// Add this filter // Add this filter