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

DetailsList: column width as a percentage #6973

Closed
Rafaelki opened this issue Nov 5, 2018 · 5 comments
Closed

DetailsList: column width as a percentage #6973

Rafaelki opened this issue Nov 5, 2018 · 5 comments

Comments

@Rafaelki
Copy link

Rafaelki commented Nov 5, 2018

Describe the feature that you would like added
For the DetailsList component, be able to specify column width as a percentage, so it resizes nicely.

Have you discussed this feature with our team, and if so, who
No

@kenotron
Copy link
Member

kenotron commented Nov 5, 2018

Here's how you can accomplish this with mergeStyles with DetailsList without Fabric changes:
https://codepen.io/anon/pen/YRXPBN?editors=0011

@kenotron
Copy link
Member

kenotron commented Nov 5, 2018

Re-open and adding a label for author feedback - making sure author has a chance to respond.

@kenotron kenotron reopened this Nov 5, 2018
@kenotron
Copy link
Member

kenotron commented Nov 5, 2018

Feel free to close @Rafaelki if this solves your issue.

@kenotron
Copy link
Member

kenotron commented Nov 5, 2018

Ah, going back to this bug, I realized that this is requesting Column Width. Not the whole list. This is not supported because we have column resize feature, etc. So this is a "by design" for now. We'll be working on a data table feature in the future that would probably support what you want (but it'd be less featureful probably). Hopefully that could address your needs in the future.

@Rafaelki
Copy link
Author

Rafaelki commented Nov 5, 2018

Haha, that explains why the codepen was not working for me.
Thank you very much @kenotron !! That new component less featureful is exactly what I am looking for!! Hopefully markup with the table element.

In the meantime I did my own one - less less less featureful, hehe:

export default class FluidTable extends React.Component<IFluidTableProps, {}> {
  public render(): React.ReactElement<IFluidTableProps> {
    return (
      <div className={styles.fluidTable}>
        <table className={this.props.className}>
          <tr>
            {this.props.columns.map(c =>
              <th scope="col">{c.name}</th>
            )}
          </tr>
          {this.props.items.map((p, i) =>
            <tr>
              {this.props.columns.map(c =>
                <td>
                  {c.onRender ? c.onRender(p, i) : p[c.fieldName]}
                </td>
              )}
            </tr>
          )}
        </table>
      </div>
    );
  }
}

@Rafaelki Rafaelki closed this as completed Nov 5, 2018
@microsoft microsoft deleted a comment from msft-github-bot Jun 12, 2019
@microsoft microsoft locked as resolved and limited conversation to collaborators Aug 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants