Filter table by specific column(s) but still show every column.

Hi,

I want to be able to filter by a specific column of the table (through Inputs.search), but not narrow the table to just that column.

Currently I have:

viewof theseCols =  Inputs.select(data.columns, {multiple:true, value:data.columns})
viewof search  = {
  let n = Inputs.search(data,{
  columns:theseCols
});
return n
}
Inputs.table(search)

This does succesfully allow to search for only the selected columns, but also narrows the table down to just those columns. I’d like for every column to remain visible.

Thanks.

Inputs.search() adds a .columns property to the result array which Inputs.table() uses as default column set. You can either define your own columns:

Inputs.table(search, {columns: ["a", "b", ...]})

or replace the property:

Inputs.table(Object.assign(search, {columns: null}))

or filter it out:

Inputs.table([...search])
1 Like