import * as React from 'react';
import { DetailsList, DetailsRow, IDetailsRowStyles, IDetailsListProps } from '@fluentui/react/lib/DetailsList';
import { createListItems, IExampleItem } from '@fluentui/example-data';
import { getTheme } from '@fluentui/react/lib/Styling';
const theme = getTheme();
export class DetailsListCustomRowsExample extends React.Component<{}, {}> {
private _items: IExampleItem[];
constructor(props: {}) {
super(props);
this._items = createListItems(500);
}
public render() {
return (
);
}
private _onRenderRow: IDetailsListProps['onRenderRow'] = props => {
const customStyles: Partial = {};
if (props) {
if (props.itemIndex % 2 === 0) {
// Every other row renders with a different background color
customStyles.root = { backgroundColor: theme.palette.themeLighterAlt };
}
return ;
}
return null;
};
}