Skip to content

Unable to align column header and body differently #494

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

Closed
pbrianmackey opened this issue Jun 6, 2016 · 3 comments
Closed

Unable to align column header and body differently #494

pbrianmackey opened this issue Jun 6, 2016 · 3 comments

Comments

@pbrianmackey
Copy link

pbrianmackey commented Jun 6, 2016

I have

<TableHeaderColumn dataField="myData" className='alignHeader' columnClassName="alignColumn" dataAlign="right">MyData</TableHeaderColumn>

  .alignHeader{
    text-align: left;
  }
  .alignColumn{
    text-align: right;;
  }

The output is

<th class="alignHeader " style="text-align: right; width: 300px; min-width: 300px;" title="MyData" data-reactid=".0.0.0.2.0.1.1.0.0.0.0.1:$7/=17" data-field="myData"><span data-reactid=".0.0.0.2.0.1.1.0.0.0.0.1:$7/=17.0">MyData</span><div data-reactid=".0.0.0.2.0.1.1.0.0.0.0.1:$7/=17.2"></div></th>

The style overrides whatever I input for className. I want the header to text align left and the body align right. How can I do this?

@AllenFang
Copy link
Owner

@pbrianmackey, I'll check if there's some bug. Thanks.

@AllenFang
Copy link
Owner

@pbrianmackey, because a dataAlign is being right so that react-bootstrap-table will keep the column of header and body as align right, and this is be applied on inline style, that's why you can't overwrite the text-align. I'm going to support a headerAlign props for fixing this issues, so In next version, your code will be:

<TableHeaderColumn dataField='myData' dataAlign='right' headerAlign='left'>

AllenFang added a commit that referenced this issue Jun 9, 2016
@AllenFang
Copy link
Owner

Release on v2.3.5. Thanks

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

No branches or pull requests

2 participants