Merge pull request #1750 from Abderahman88/sortPeople
[react-directory] Fix 'Sort people by'
This commit is contained in:
commit
707242011e
|
@ -30,10 +30,14 @@
|
||||||
|
|
||||||
![directory](./assets/react-directory-withPaging.png)
|
![directory](./assets/react-directory-withPaging.png)
|
||||||
|
|
||||||
|
## Compatibility
|
||||||
|
|
||||||
|
![SPFx 1.11](https://img.shields.io/badge/SPFx-1.11.0-green.svg)
|
||||||
|
![Node.js LTS 10.x](https://img.shields.io/badge/Node.js-LTS%2010.x-green.svg)
|
||||||
|
![SharePoint Online](https://img.shields.io/badge/SharePoint-Online-yellow.svg)
|
||||||
|
![Teams N/A: Untested with Microsoft Teams](https://img.shields.io/badge/Teams-N%2FA-lightgrey.svg "Untested with Microsoft Teams")
|
||||||
|
![Workbench Hosted: Does not work with local workbench](https://img.shields.io/badge/Workbench-Hosted-yellow.svg "Does not work with local workbench")
|
||||||
|
|
||||||
## Used SharePoint Framework Version
|
|
||||||
![SPFx 1.11](https://img.shields.io/badge/version-1.11-green.svg)
|
|
||||||
|
|
||||||
## Applies to
|
## Applies to
|
||||||
|
|
||||||
|
@ -53,6 +57,7 @@ Properties to sent as clear text | text | No | By default if the search key has
|
||||||
Results per page | number | Yes | Number of people result to be displayed per page. Max of **20** is allowed, default of **10** is set.
|
Results per page | number | Yes | Number of people result to be displayed per page. Max of **20** is allowed, default of **10** is set.
|
||||||
|
|
||||||
## Solution
|
## Solution
|
||||||
|
|
||||||
The web part use PnPjs library, Office-ui-fabric-react components
|
The web part use PnPjs library, Office-ui-fabric-react components
|
||||||
|
|
||||||
Solution|Author(s)
|
Solution|Author(s)
|
||||||
|
@ -60,6 +65,7 @@ Solution|Author(s)
|
||||||
Directory Web Part|João Mendes
|
Directory Web Part|João Mendes
|
||||||
Directory Web Part| Peter Paul Kirschner ([@petkir_at](https://twitter.com/petkir_at))
|
Directory Web Part| Peter Paul Kirschner ([@petkir_at](https://twitter.com/petkir_at))
|
||||||
Directory Web Part| Sudharsan K ([@sudharsank](https://twitter.com/sudharsank))
|
Directory Web Part| Sudharsan K ([@sudharsank](https://twitter.com/sudharsank))
|
||||||
|
Directory Web Part| Abderahman Moujahid
|
||||||
|
|
||||||
## Version history
|
## Version history
|
||||||
|
|
||||||
|
@ -67,8 +73,9 @@ Version|Date|Comments
|
||||||
-------|----|--------
|
-------|----|--------
|
||||||
1.0.0|July 29, 2019|Initial release
|
1.0.0|July 29, 2019|Initial release
|
||||||
1.0.1|July 19, 2020|Bugfix and mock-service for workbench (```LivePersonaCard``` not supported in workbench)
|
1.0.1|July 19, 2020|Bugfix and mock-service for workbench (```LivePersonaCard``` not supported in workbench)
|
||||||
2.0.0.0|Sep 18 2020|React hooks, paging, dynamic search props, result alignment using office ui fabric stack.
|
2.0.0|Sep 18 2020|React hooks, paging, dynamic search props, result alignment using office ui fabric stack.
|
||||||
3.0.0.0|Oct 17 2020|Minor fixes and add the additional web part property.
|
3.0.0|Oct 17 2020|Minor fixes and add the additional web part property.
|
||||||
|
3.0.1|March 4 2021|Bugfix 'Sort People by'
|
||||||
|
|
||||||
|
|
||||||
## Disclaimer
|
## Disclaimer
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
},
|
},
|
||||||
"name": "Search Directory",
|
"name": "Search Directory",
|
||||||
"id": "5b62bc16-3a71-461d-be2f-16bfcb011e8a",
|
"id": "5b62bc16-3a71-461d-be2f-16bfcb011e8a",
|
||||||
"version": "3.0.0.0",
|
"version": "3.0.1.0",
|
||||||
"includeClientSideAssets": true,
|
"includeClientSideAssets": true,
|
||||||
"skipFeatureDeployment": true,
|
"skipFeatureDeployment": true,
|
||||||
"isDomainIsolated": false
|
"isDomainIsolated": false
|
||||||
|
|
|
@ -5,7 +5,7 @@ interface MinimalMockUser {
|
||||||
FirstName: string;
|
FirstName: string;
|
||||||
LastName: string;
|
LastName: string;
|
||||||
Department: string;
|
Department: string;
|
||||||
Location: string;
|
BaseOfficeLocation: string;
|
||||||
Title: string;
|
Title: string;
|
||||||
PreferredName: string;
|
PreferredName: string;
|
||||||
WorkPhone: string;
|
WorkPhone: string;
|
||||||
|
@ -68,7 +68,7 @@ export class spMockServices implements ISPServices {
|
||||||
LastName: `${lastNameL}LastName${i}`,
|
LastName: `${lastNameL}LastName${i}`,
|
||||||
PreferredName: `${firstNameL}FirstName${i} ${lastNameL}LastName${i}`,
|
PreferredName: `${firstNameL}FirstName${i} ${lastNameL}LastName${i}`,
|
||||||
Department: i % 2 === 0 ? `${lastNameL}Department` : `${firstNameL}Department`,
|
Department: i % 2 === 0 ? `${lastNameL}Department` : `${firstNameL}Department`,
|
||||||
Location: i % 3 === 0 ? `${lastNameL}Location` : `${firstNameL}Location`,
|
BaseOfficeLocation: i % 3 === 0 ? `${lastNameL}Location` : `${firstNameL}Location`,
|
||||||
Title: i % 2 === 0 ? `${lastNameL}JobTitle` : `${firstNameL}JobTitle`,
|
Title: i % 2 === 0 ? `${lastNameL}JobTitle` : `${firstNameL}JobTitle`,
|
||||||
WorkPhone: '' + Math.floor(Math.random() * 1234) + 54678900
|
WorkPhone: '' + Math.floor(Math.random() * 1234) + 54678900
|
||||||
});
|
});
|
||||||
|
|
|
@ -142,7 +142,6 @@ export default class Directory extends React.Component<
|
||||||
searchText,
|
searchText,
|
||||||
this.props.searchFirstName
|
this.props.searchFirstName
|
||||||
);
|
);
|
||||||
debugger;
|
|
||||||
if (users && users.PrimarySearchResults.length > 0) {
|
if (users && users.PrimarySearchResults.length > 0) {
|
||||||
for (let index = 0; index < users.PrimarySearchResults.length; index++) {
|
for (let index = 0; index < users.PrimarySearchResults.length; index++) {
|
||||||
let user: any = users.PrimarySearchResults[index];
|
let user: any = users.PrimarySearchResults[index];
|
||||||
|
|
|
@ -192,7 +192,7 @@ const DirectoryHook: React.FC<IDirectoryProps> = (props) => {
|
||||||
_searchUsers = debounce(500, _searchUsers);
|
_searchUsers = debounce(500, _searchUsers);
|
||||||
|
|
||||||
const _sortPeople = async (sortField: string) => {
|
const _sortPeople = async (sortField: string) => {
|
||||||
let _users = state.users;
|
let _users = [...state.users];
|
||||||
_users = _users.sort((a: any, b: any) => {
|
_users = _users.sort((a: any, b: any) => {
|
||||||
switch (sortField) {
|
switch (sortField) {
|
||||||
// Sorte by FirstName
|
// Sorte by FirstName
|
||||||
|
|
Loading…
Reference in New Issue