style for IColumn in DetailsList beside className
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?
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
Thanks @micahgodbolt ! that works great