diff --git a/samples/react-copy-views/config/package-solution.json b/samples/react-copy-views/config/package-solution.json index f22ce4166..87b6d56aa 100644 --- a/samples/react-copy-views/config/package-solution.json +++ b/samples/react-copy-views/config/package-solution.json @@ -3,7 +3,7 @@ "solution": { "name": "copy-views-client-side-solution", "id": "f9a94606-ce1c-487c-ab87-550b240421de", - "version": "1.0.2.0", + "version": "1.0.2.1", "includeClientSideAssets": true, "skipFeatureDeployment": true, "isDomainIsolated": false, diff --git a/samples/react-copy-views/src/shared/services/ListViewsService.ts b/samples/react-copy-views/src/shared/services/ListViewsService.ts index da569a6a8..ad5a03548 100644 --- a/samples/react-copy-views/src/shared/services/ListViewsService.ts +++ b/samples/react-copy-views/src/shared/services/ListViewsService.ts @@ -43,7 +43,7 @@ export class ListViewsService implements IListViewsService { const web = Web([this._sp.web, siteUrl]); - const views = await web.lists.getById(listId).views.select("Id", "Title", "ServerRelativeUrl", "ViewType2")(); + const views = await web.lists.getById(listId).views.orderBy("Title", true).select("Id", "Title", "ServerRelativeUrl", "ViewType2")(); return views.map((view: IViewInfo) => { const viewFileName = view.ServerRelativeUrl.substring(view.ServerRelativeUrl.lastIndexOf('/') + 1); diff --git a/samples/react-copy-views/src/shared/services/ListsService.ts b/samples/react-copy-views/src/shared/services/ListsService.ts index 715c5ba51..95b543053 100644 --- a/samples/react-copy-views/src/shared/services/ListsService.ts +++ b/samples/react-copy-views/src/shared/services/ListsService.ts @@ -51,7 +51,7 @@ export class ListsService implements IListsService { "EntityTypeName ne 'FormServerTemplates'" // Exclude the Form Templates library ]; - const lists = await web.lists.expand("RootFolder").select("Id", "Title", "BaseType", "RootFolder/ServerRelativeUrl").filter(filterConditions.join(" and "))(); + const lists = await web.lists.expand("RootFolder").select("Id", "Title", "BaseType", "RootFolder/ServerRelativeUrl").orderBy("Title", true).filter(filterConditions.join(" and "))(); return lists .filter(l => l.BaseType === 1 || l.BaseType === 0) @@ -105,8 +105,9 @@ export class ListsService implements IListsService { } }); + // Sort on title to help list selection. Sorting on title is impossible serverside because Title is not sortable. return mappedResults.sort((a, b) => { - if (a.siteUrl < b.siteUrl) { return -1; } else if (a.siteUrl > b.siteUrl) { return 1; } else { return 0; } + if (a.title < b.title) { return -1; } else if (a.title > b.title) { return 1; } else { return 0; } }); }