()
| 67 | ] |
| 68 | |
| 69 | function App() { |
| 70 | const [data, setData] = createSignal(makeData(50000)) |
| 71 | const [columnFilters, setColumnFilters] = createSignal<ColumnFiltersState>([]) |
| 72 | const [globalFilter, setGlobalFilter] = createSignal('') |
| 73 | const debounceSetGlobalFilter = debounce( |
| 74 | (value: string) => setGlobalFilter(value), |
| 75 | 500, |
| 76 | ) |
| 77 | const refreshData = () => setData(makeData(50000)) |
| 78 | |
| 79 | const table = createSolidTable({ |
| 80 | get data() { |
| 81 | return data() |
| 82 | }, |
| 83 | columns, |
| 84 | state: { |
| 85 | get columnFilters() { |
| 86 | return columnFilters() |
| 87 | }, |
| 88 | get globalFilter() { |
| 89 | return globalFilter() |
| 90 | }, |
| 91 | }, |
| 92 | onGlobalFilterChange: setGlobalFilter, |
| 93 | globalFilterFn: 'includesString', |
| 94 | onColumnFiltersChange: setColumnFilters, |
| 95 | getCoreRowModel: getCoreRowModel(), |
| 96 | getFilteredRowModel: getFilteredRowModel(), |
| 97 | getFacetedRowModel: getFacetedRowModel(), |
| 98 | getFacetedUniqueValues: getFacetedUniqueValues(), |
| 99 | getFacetedMinMaxValues: getFacetedMinMaxValues(), |
| 100 | debugTable: true, |
| 101 | debugHeaders: true, |
| 102 | debugColumns: false, |
| 103 | }) |
| 104 | |
| 105 | return ( |
| 106 | <div class="p-2"> |
| 107 | <input |
| 108 | class="p-2 font-lg shadow border border-block" |
| 109 | value={globalFilter() ?? ''} |
| 110 | onInput={(e) => debounceSetGlobalFilter(e.currentTarget.value)} |
| 111 | placeholder="Search all columns..." |
| 112 | /> |
| 113 | <div className="h-2" /> |
| 114 | <table> |
| 115 | <thead> |
| 116 | <For each={table.getHeaderGroups()}> |
| 117 | {(headerGroup) => ( |
| 118 | <tr> |
| 119 | <For each={headerGroup.headers}> |
| 120 | {(header) => ( |
| 121 | <th colSpan={header.colSpan}> |
| 122 | {header.isPlaceholder ? null : ( |
| 123 | <> |
| 124 | {flexRender( |
| 125 | header.column.columnDef.header, |
| 126 | header.getContext(), |
nothing calls this directly
no test coverage detected