Skip to content

Conversation

@MaxLustig
Copy link
Contributor

@MaxLustig MaxLustig commented Sep 26, 2017

Pull request checklist

  • Addresses an existing issue: Fixes #0000
  • Include a change request file using $ npm run change

Description of changes

By default, cells in a details list are top-aligned. They can be made vertically centered using className in the IColumn definition for each column, but the checkbox cell does not take a className as a property. This adds the ability to provide a className to be applied to the checkbox's containing cell.

@msftclas
Copy link

msftclas commented Sep 26, 2017

CLA assistant check
All CLA requirements met.

/**
* Boolean value to indicate if the cells should be vertically centered rather than top-aligned
*/
verticallyCenterCells?: boolean;
Copy link
Member

@dzearing dzearing Sep 26, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cschleiden What do you think? This is what we've resolved:

  1. The default of vertically align top makes the most sense
  2. In some cases, we need to center the content

So the #2 is what @MaxLustig is dealing with and right now it's tricky to do so.

Maybe this should just be done through column definitions. I think defaulting every cell to center might not be desired in every column.

I think column takes a className that gets injected on each cell, could that be a solution here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm really, really against this property. We have to be more modular, not less. Can't you do it with an onRender callback in the column?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested out using className on the column definition, which works perfectly well. That'll work for my scenario at least. However, there was a change last week that vertically centers the checkmark in details row, which I had fixed as part of this change. Should I just get rid of all the centering code and keep that change or open up a new PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I found one issue with using className in column definition, in that the checkbox does not take a className (and therefore cannot be centered). I've updated the PR to enable providing a css class for the checkbox's cell.

@MaxLustig MaxLustig changed the title Add option for vertically centering cells in a details list Add ability to add optional css class for checkbox cell Sep 26, 2017
/**
* Optional class name to add to the cell of a checkbox
*/
checkboxClassName?: string;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already have on check... props, should we go all the way and take ICheckProps?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, synced offline. the DetailsCheck and CheckProps have their own issues so it might be fine.

Only complaint, while the comment explains correctly that the class is added to the cell of the checkbox, the name doesn't match that. Can we find a better one?

/**
* Optional class name to add to the cell of a checkbox
*/
checkboxClassName?: string;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, synced offline. the DetailsCheck and CheckProps have their own issues so it might be fine.

Only complaint, while the comment explains correctly that the class is added to the cell of the checkbox, the name doesn't match that. Can we find a better one?

@MaxLustig MaxLustig force-pushed the maxlus/verticallyCenterCells branch from 8241e64 to bd2218e Compare September 27, 2017 17:49
@cschleiden cschleiden merged commit c3d63f9 into microsoft:master Sep 28, 2017
kellygorr pushed a commit to kellygorr/office-ui-fabric-react that referenced this pull request Nov 16, 2017
* Added property to IDetailsListProps to support vertically centering cells

* Fixed vertical centering issue with checkbox

* Added change file

* Removed verticallyCenterCells

* Added ability to add css class to checkbox cell

* Fixed issue with DetailsRowProps declaration

* Changed change file

* Changed name to checkboxCellClassName

* Update maxlus-verticallyCenterCells_2017-09-26-21-11.json
ohritz pushed a commit to ohritz/office-ui-fabric-react that referenced this pull request Dec 5, 2017
* Added property to IDetailsListProps to support vertically centering cells

* Fixed vertical centering issue with checkbox

* Added change file

* Removed verticallyCenterCells

* Added ability to add css class to checkbox cell

* Fixed issue with DetailsRowProps declaration

* Changed change file

* Changed name to checkboxCellClassName

* Update maxlus-verticallyCenterCells_2017-09-26-21-11.json
@microsoft microsoft locked as resolved and limited conversation to collaborators Aug 31, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants