Skip to content

React accordion section - sorting in created order not alphabetical order #1926

Answered by AriGunawan
gonfishin asked this question in Q&A
Discussion options

You must be logged in to vote

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:

  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
          });
        })
       …

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@gonfishin
Comment options

Answer selected by gonfishin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants