diff --git a/packages/builder/src/components/backend/DataTable/DataTable.svelte b/packages/builder/src/components/backend/DataTable/DataTable.svelte index d145b3136c..7a04783579 100644 --- a/packages/builder/src/components/backend/DataTable/DataTable.svelte +++ b/packages/builder/src/components/backend/DataTable/DataTable.svelte @@ -7,17 +7,16 @@ import EditRolesButton from "./buttons/EditRolesButton.svelte" import ManageAccessButton from "./buttons/ManageAccessButton.svelte" import HideAutocolumnButton from "./buttons/HideAutocolumnButton.svelte" + import TableFilterButton from "./buttons/TableFilterButton.svelte" import Table from "./Table.svelte" import { TableNames } from "constants" import CreateEditRow from "./modals/CreateEditRow.svelte" import { fetchTableData } from "helpers/fetchTableData" - import { Layout, Pagination, Select, Input } from "@budibase/bbui" - import { OperatorOptions } from "constants/lucene" + import { Pagination } from "@budibase/bbui" const search = fetchTableData() let hideAutocolumns = true - let searchColumn - let searchValue + let filters $: isUsersTable = $tables.selected?._id === TableNames.USERS $: title = $tables.selected?.name @@ -26,15 +25,14 @@ $: isInternal = type !== "external" $: id = $tables.selected?._id $: columnOptions = Object.keys($search.schema || {}) - $: filter = buildFilter(searchColumn, searchValue) - $: fetchTable(id, filter) + $: fetchTable(id, filters) // Fetches new data whenever the table changes - const fetchTable = (tableId, filter) => { + const fetchTable = (tableId, filters) => { search.update({ tableId, schema, - filter, + filters, limit: 10, paginate: true, }) @@ -47,23 +45,6 @@ sortOrder: e.detail.order, }) } - - // Builds a filter expression to search with - const buildFilter = (column, value) => { - if (!column || !value) { - return null - } - return [ - { - type: "string", - field: column, - operator: OperatorOptions.StartsWith.value, - value, - }, - ] - } - - $: console.log(filter)