Skip to content
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

rowSpan Property #115

Closed
dragos-rosca opened this issue Oct 11, 2019 · 5 comments
Closed

rowSpan Property #115

dragos-rosca opened this issue Oct 11, 2019 · 5 comments
Labels

Comments

@dragos-rosca
Copy link
Contributor

dragos-rosca commented Oct 11, 2019

I needed to add "rowSpan" to my <Td> component and it didn't work. Then I looked over the code and saw that the "colSpan" attribute is being considered and when this is sent to the component all the other props are also sent to the html <td> component.

This means that if I use <Td rowSpan={2}>[...]</Td> the "rowSpan" attribute will get ignored but if I use something like <Td colSpan={1} rowSpan={2}>[...]</Td> my "rowSpan" attribute will be passed to the html <td> component and I will get my desired functionality.

Can you please pass the props to the html <td> component when there is no "colSpan" involved?

class TdInner extends React.Component {
  render() {
    if (this.props.colSpan) {
      return <td {...allowed(this.props)} />
    }
    const { headers, children, columnKey } = this.props
    const classes = (this.props.className || '') + ' pivoted'
    return (
      <td className={classes} {...allowed(this.props)}> {/*<<=== Here I added the props */}
        <div className="tdBefore">{headers[columnKey]}</div>
        {children || <div>&nbsp;</div>}
      </td>
    )
  }
}
@coston
Copy link
Owner

coston commented Oct 11, 2019

Hey @dragos-rosca! Thanks for bringing this issue to light. Would you like to contribute a pull request?

@dragos-rosca
Copy link
Contributor Author

Hello, thank you for the opportunity but I think you guys will do a better job.
Like there's a bug in my comment that overrides the "className" property in the <td> excluding your "pivoted" class.

@dragos-rosca
Copy link
Contributor Author

I created a fork and I will add the code the best I can. See you at pull request!

dragos-rosca pushed a commit to dragos-rosca/react-super-responsive-table that referenced this issue Oct 14, 2019
coston pushed a commit that referenced this issue Oct 22, 2019
* #115 Added the rest of the props to the td element

* moved the rowSpan prop form header to row and tested the result.
@coston
Copy link
Owner

coston commented Oct 22, 2019

fixed with #116

@coston coston closed this as completed Oct 22, 2019
@coston
Copy link
Owner

coston commented Oct 22, 2019

Thank you @dragos-rosca!

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

No branches or pull requests

2 participants