office-ui-fabric-react
Version:
Reusable React components for building experiences for Office 365.
28 lines • 1.42 kB
JavaScript
import * as tslib_1 from "tslib";
import * as React from 'react';
import { DetailsList, DetailsRow } from 'office-ui-fabric-react/lib/DetailsList';
import { createListItems } from '@uifabric/example-data';
import { getTheme } from 'office-ui-fabric-react/lib/Styling';
var theme = getTheme();
var DetailsListCustomRowsExample = /** @class */ (function (_super) {
tslib_1.__extends(DetailsListCustomRowsExample, _super);
function DetailsListCustomRowsExample(props) {
var _this = _super.call(this, props) || this;
_this._onRenderRow = function (props) {
var customStyles = {};
if (props.itemIndex % 2 === 0) {
// Every other row renders with a different background color
customStyles.root = { backgroundColor: theme.palette.themeLighterAlt };
}
return React.createElement(DetailsRow, tslib_1.__assign({}, props, { styles: customStyles }));
};
_this._items = createListItems(500);
return _this;
}
DetailsListCustomRowsExample.prototype.render = function () {
return React.createElement(DetailsList, { items: this._items, setKey: "set", onRenderRow: this._onRenderRow, checkButtonAriaLabel: "Row checkbox" });
};
return DetailsListCustomRowsExample;
}(React.Component));
export { DetailsListCustomRowsExample };
//# sourceMappingURL=DetailsList.CustomRows.Example.js.map