observablehq / inputs

Better input elements
https://observablehq.com/framework/lib/inputs
ISC License
125 stars 34 forks source link

Search should not alter `columns` #243

Open mootari opened 1 year ago

mootari commented 1 year ago

Inputs.search accepts the columns option to restrict filtering to a subset of columns. However, doing so also sets the .columns property on the dataset. Downstream cells that display the data via Inputs.table() will only show the filtered columns, unless the columns option is passed in explicitely.

Repro

Create a notebook with the following three cells:

data = [{foo: 1, bar: 'a'}, {foo: 2, bar: 'b'}, {foo: 3, bar: 'c'}]
viewof results = Inputs.search(data, {columns: ['foo']})
Inputs.table(results)

Notice how the table only displays the column "foo".

Screenshot

image
mtthsdzwn commented 9 months ago

I found the same error. I think it can easily be fixed by changing the columns option to column