Merge branch 'react-list-form' of https://github.com/sharepointknight/sp-dev-fx-webparts into pr/1501
This commit is contained in:
commit
d2e09e3eac
|
@ -35,26 +35,25 @@ export default class ReactAccordion extends React.Component<IReactAccordionProps
|
|||
}
|
||||
|
||||
private getListItems(): void {
|
||||
if (typeof this.props.listId !== "undefined" && this.props.listId.length > 0) {
|
||||
sp.web.lists.getById(this.props.listId).items.select("Title", "Content").get()
|
||||
if(typeof this.props.listId !== "undefined" && this.props.listId.length > 0) {
|
||||
sp.web.lists.getById(this.props.listId).items.select("Title","Content").get()
|
||||
.then((results: Array<any>) => {
|
||||
this.setState({
|
||||
items: results
|
||||
});
|
||||
})
|
||||
.catch((error: any) => {
|
||||
.catch((error:any) => {
|
||||
console.log("Failed to get list items!");
|
||||
console.log(error);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public componentDidUpdate(prevProps: IReactAccordionProps): void {
|
||||
if (prevProps.listId !== this.props.listId) {
|
||||
public componentDidUpdate(prevProps:IReactAccordionProps): void {
|
||||
if(prevProps.listId !== this.props.listId) {
|
||||
this.getListItems();
|
||||
}
|
||||
|
||||
|
||||
if(prevProps.allowMultipleExpanded !== this.props.allowMultipleExpanded || prevProps.allowZeroExpanded !== this.props.allowZeroExpanded) {
|
||||
this.setState({
|
||||
allowMultipleExpanded: this.props.allowMultipleExpanded,
|
||||
|
@ -67,7 +66,7 @@ export default class ReactAccordion extends React.Component<IReactAccordionProps
|
|||
const listSelected:boolean = typeof this.props.listId !== "undefined" && this.props.listId.length > 0;
|
||||
const { allowMultipleExpanded, allowZeroExpanded } = this.state;
|
||||
return (
|
||||
<div className={styles.reactAccordion}>
|
||||
<div className={ styles.reactAccordion }>
|
||||
{!listSelected &&
|
||||
<Placeholder
|
||||
iconName='MusicInCollectionFill'
|
||||
|
@ -92,7 +91,7 @@ export default class ReactAccordion extends React.Component<IReactAccordionProps
|
|||
</AccordionItemButton>
|
||||
</AccordionItemHeading>
|
||||
<AccordionItemPanel>
|
||||
<p dangerouslySetInnerHTML={{ __html: item.Content }} />
|
||||
<p dangerouslySetInnerHTML={{__html: item.Content}} />
|
||||
</AccordionItemPanel>
|
||||
</AccordionItem>
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue