Improve options inline searching
This commit is contained in:
parent
2ef2d07cab
commit
cfdaa3564c
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue