React-bootstrap-table2: Search when cell value is Object

Created on 5 Sep 2018  路  1Comment  路  Source: react-bootstrap-table/react-bootstrap-table2

Is there a way to make the search work for cells which values are objects and a column formatter is used to represent a JSX code containing these values?

For example, we have:

const columns = [{
    dataField: 'name',
    text: 'Field name',
    formatter: (cell) => (<div>
        <div>{cell.title}</div>
        <div>{cell.subtitle}</div>
        <img src="{cell.icon}" >
    </div>)
}]

const data = [{
    name: {
        title: 'Example text',
        subtitle: 'Another example text',
        icon: 'icon-example.png'
    }, {
        ...
    },
    ....
}]

And then we have:

< ToolkitProvider 
    columns={ columns }
    data={ data }
    search={ { searchFormatted: true  } } >
    {
        props => <div>
            <Search  {...props.searchProps} />
            <BootstrapTable {...props.baseProps} />
       </div>
    }
</ToolkitProvider

I really need this feature, but couldn't find any documentation about searching through cells with Object values.

Thank you

Most helpful comment

I found the solution to this in the documentation here . I tried using filterValue at first but using it in combination with search={{ searchFormatted: true }} caused the search not to work on this column.

>All comments

I found the solution to this in the documentation here . I tried using filterValue at first but using it in combination with search={{ searchFormatted: true }} caused the search not to work on this column.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

SandeepKapalawai picture SandeepKapalawai  路  3Comments

eylonronen picture eylonronen  路  3Comments

Randore picture Randore  路  3Comments

thevangelist picture thevangelist  路  4Comments

epsyan picture epsyan  路  4Comments