React accordion section - sorting in created order not alphabetical order #1926
-
Hi, firstly I would like to say thanks to all the contributors for their work on this webpart. @hugoabernier, I installed the webpart and find that it's listing the entries by the order that the items were created in the referenced list. The SharePoint list is sorted alphabetically in the default view. Is there a way to have the accordion webpart display current and future entries in alphabetical order? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @gonfishin, I think the only way to make it display in alphabetical order is by updating the code. 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()
+ sp.web.lists.getById(this.props.listId).items.select("Title","Content").orderBy("Title").get()
.then((results: Array<any>) => {
this.setState({
items: results
});
})
.catch((error:any) => {
console.log("Failed to get list items!");
console.log(error);
});
}
} |
Beta Was this translation helpful? Give feedback.
Hi @gonfishin,
I don't find any configuration for ordering the items in that web part.
I think the only way to make it display in alphabetical order is by updating the code.
You can try to update the ReactAccordion.tsx file to get the list items ordered by the title: