Skip to content

Adding support of nesting TableHeaderColumn. Merge their props. #1504

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 29, 2017

Conversation

IgorZh
Copy link
Contributor

@IgorZh IgorZh commented Jul 21, 2017

If I wrap TableHeaderColumn BootstrapTable read props only of wrapper, but don't read props of wrapped TableHeaderColum. This PR fix that behaviour.

@philipp-sorin
Copy link

Yeh, this one is kinda helpful

@AllenFang
Copy link
Owner

@IgorZh Thanks for contributions, I will review it, BTW, could your please show me your use case? thanks

@IgorZh
Copy link
Contributor Author

IgorZh commented Jul 23, 2017

Hi, @AllenFang, thanks for your response. Here is my case. In need to use react-bootstrap-table table with redux-form.
I created TableHeaderColumn wrapper like this

class TableHeaderHeaderColumnField extends React.PureComponent {
  render() {
    return (
	<TableHeaderColumn
          {...this.props}
	  dataFormat={this.renderField}
       />
    );
  }

  renderField = (value, row, formatExtraData, rowIdx) => {
    const {
      name,
      tableName,
    } = this.props;

    return (
	<Field
          {...this.props}
	  name={`${tableName}[${rowIdx}].${name}`}
       />
    );
  };
}

and then use use it like this. I define redux-form props directly in HeaderColumnViewEditField

<BootstrapTable>
	<HeaderColumnViewEditField>
                name='description'
                component={Text}
		{t('description')}
	</HeaderColumnViewEditField>
</BootstrapTable>

@philipp-sorin
Copy link

@AllenFang Hey, I am really sorry but how fast can you review it, this issue is a blocker for my project as well :)

@AllenFang
Copy link
Owner

@philipp-sorin I'll release in this couple day.

@AllenFang AllenFang merged commit 60dab6f into AllenFang:master Jul 29, 2017
@AllenFang
Copy link
Owner

This PR was released on v3.5.0, thanks your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants