Client Sorting, not every Source support this

This commit is contained in:
petkir 2020-07-11 19:58:20 +02:00
parent 9cfbdaf142
commit 2ecc46ce3c

View File

@ -109,7 +109,7 @@ export default class CalendarFeedSummary extends React.Component<ICalendarFeedSu
// put everything together in a nice little calendar view
return (
<div className={css(styles.calendarFeedSummary, styles.webPartChrome)} style={{backgroundColor: semanticColors.bodyBackground}}>
<div className={css(styles.calendarFeedSummary, styles.webPartChrome)} style={{ backgroundColor: semanticColors.bodyBackground }}>
<div className={css(styles.webPartHeader, styles.headerSmMargin)}>
<WebPartTitle displayMode={this.props.displayMode}
title={this.props.title}
@ -265,7 +265,7 @@ export default class CalendarFeedSummary extends React.Component<ICalendarFeedSu
event={item}
isNarrow={true}
themeVariant={this.props.themeVariant}
/>
/>
)} />
{usePaging &&
<Pagination
@ -307,7 +307,7 @@ export default class CalendarFeedSummary extends React.Component<ICalendarFeedSu
event={event}
isNarrow={false}
themeVariant={this.props.themeVariant} />
);
);
})}
</FilmstripLayout>
</div>
@ -354,6 +354,10 @@ export default class CalendarFeedSummary extends React.Component<ICalendarFeedSu
try {
let events = await dataProvider.getEvents();
if (!!events && events.length > 0) {
// order result bacause not every Dataprovider Support Order
events = events.sort((a: ICalendarEvent, b: ICalendarEvent) => { return a.start > b.start ? 1 : - 1; });
}
if (dataProvider.MaxTotal > 0) {
events = events.slice(0, dataProvider.MaxTotal);
}