Sp-dev-fx-webparts: React-AccordionFAQ

Created on 10 Jun 2020  路  4Comments  路  Source: pnp/sp-dev-fx-webparts

Thank you for asking a question! Use the sections below to submit a question ONLY if it's related to samples in this repo. If you have an issue or question about the SharePoint Framework or its documentation, please submit it at https://aka.ms/spdev-issues

  • Questions that do not follow the below template will automatically be closed
  • All questions are welcome - let us know what's on your mind!
  • This repo is maintained by volunteers (not Microsoft). Please be courteous and patient. 馃檪
  • Include sufficient details and context.
  • If you have multiple questions please submit them separately so we can track resolution.
  • Screenshots are always helpful (just paste any images right here in the question)

DELETE EVERYTHING ABOVE AFTER READING - THANKS!

Sample (which sample are you talking about)

https://github.com/pnp/sp-dev-fx-webparts/tree/master/samples/react-accordion

Authors

@gautamdsheth - React Accordion from Rapid Circle

Question (the more details, the better)

The react Accordion FAQ renders perfectly the way it is supposed to display the default List view of the FAQ List entries. My question is around displaying the list entries based on the created date, no matter I change the default list view to sort the list items by created date, the web part displays only the faq entries by the default SharePoint list ID. What is the code change to display the FAQ by the most recent ones?

reactaccordionList

help wanted question

Most helpful comment

Hi @Abiman194

You have to add the order by in the Rest API line number 69:

//instead of this url
 let restAPI = this.props.siteUrl + `/_api/web/Lists/GetByTitle('${this.props.listName}')/items?$select=Title,Description`;
//add the order by to sort based on created
 let restAPI = this.props.siteUrl + `/_api/web/Lists/GetByTitle('${this.props.listName}')/items?$select=Title,Description&$orderby=Created desc`;

image

All 4 comments

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.

Hi @Abiman194

You have to add the order by in the Rest API line number 69:

//instead of this url
 let restAPI = this.props.siteUrl + `/_api/web/Lists/GetByTitle('${this.props.listName}')/items?$select=Title,Description`;
//add the order by to sort based on created
 let restAPI = this.props.siteUrl + `/_api/web/Lists/GetByTitle('${this.props.listName}')/items?$select=Title,Description&$orderby=Created desc`;

image

Hi @Abiman194 ,

Hi @Abiman194

You have to add the order by in the Rest API line number 69:

//instead of this url
 let restAPI = this.props.siteUrl + `/_api/web/Lists/GetByTitle('${this.props.listName}')/items?$select=Title,Description`;
//add the order by to sort based on created
 let restAPI = this.props.siteUrl + `/_api/web/Lists/GetByTitle('${this.props.listName}')/items?$select=Title,Description&$orderby=Created desc`;

image

Hi @Abiman194 , if this comment has helped you to solve your issue, please make the issue as resolved/closed. :)

Resolved. Thank you

Was this page helpful?
0 / 5 - 0 ratings