fluentui icon indicating copy to clipboard operation
fluentui copied to clipboard

style for IColumn in DetailsList beside className

Open artxach opened this issue 9 years ago • 2 comments

Bug Report

  • Package version(s): 4.38.0 Office UI Fabric React
  • Browser and OS versions: Any browser

Priorities and help requested (not applicable if asking question):

Requested priority: Normal

Describe the issue:

I am using DetailsList component from OUIFR library. I have implemented my own onRender method for each IColumn. For some columns it can return pure string, for others - different html elements. During runtime i construct some styles, e.g. {foreground:'#456789', align:'right', fontWeight:'bold'} etc. and want these styles to be applied to the DetailsList Cell itself and not the control which is return by onRender method. I am aware the IColumn has className property, but i cannot use it as my styles are not hard coded, instead i get them runtime, so it would be great if i could just assign the style to the IColumn's style property which doesn't exist at this moment.

Expected behavior:

Can i somehow overcome this issue, is there any way to do that?

artxach avatar Sep 07 '17 16:09 artxach

Have you seen our MergeStyles function? If IColumn takes a classname, it may be possible to use MergeStyles to generate a classname on the fly with the styles you pass in.

Check out

https://github.com/OfficeDev/office-ui-fabric-react/blob/9a5a9e2f3583ffda8e60a155f96c800e28a9af47/packages/experiments/src/components/LayoutGroup/LayoutGroup.tsx#L31

micahgodbolt avatar Sep 08 '17 17:09 micahgodbolt

Thanks @micahgodbolt ! that works great

artxach avatar Sep 11 '17 09:09 artxach