Skip to content

Default value not working for select filter in remote mode #1025

Closed
@BenoitAverty

Description

@BenoitAverty

I have a table with two enum columns, And I added a filter on them (the table is in remote mode).

Here is a piece of my code :

<TableHeaderColumn dataField="customerType" dataSort
  filter={{ type: 'SelectFilter', options: zipObj(props.customerTypes, props.customerTypes),
  defaultValue: filterDefaults.customerType }}
>
  Type
</TableHeaderColumn>

The options object looks like this (zipObj if from the ramda library):

{
  'EASY': 'EASY',
  'SIR': 'SIR'
}

and the defaultValue is 'EASY'.

I noticed in the code that you use the defaultValue attribute on the select tag, but I think it should just be value. (See here : https://github.com/AllenFang/react-bootstrap-table/blob/master/src/filters/Select.js#L63)

I tried to change this in my node_modules folder and the right option was selected, but then it had some strange behaviors, the style was the same as when the placeholder is selected, and I couldn't select the placeholder anymore.

Can you help me figure out what's wrong if it's my code, or publish a fix to this problem ? I'm more than happy to do a PR but I don't see the problem besides the defaultValue attribute.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions