MOBILE-3281 users: Keep selected item if present in list
parent
088dbcd821
commit
db75044386
|
@ -161,16 +161,10 @@ export class CoreUserParticipantsComponent implements OnInit {
|
||||||
this.displaySearchResults = false;
|
this.displaySearchResults = false;
|
||||||
this.participants = [];
|
this.participants = [];
|
||||||
this.searchPage = 0;
|
this.searchPage = 0;
|
||||||
this.splitviewCtrl.emptyDetails();
|
|
||||||
|
|
||||||
// Remove search results and display all participants.
|
// Remove search results and display all participants.
|
||||||
this.participantsLoaded = false;
|
this.participantsLoaded = false;
|
||||||
this.fetchData(true).then(() => {
|
this.fetchData(true);
|
||||||
if (this.splitviewCtrl.isOn() && this.participants.length > 0) {
|
|
||||||
// Take first and load it.
|
|
||||||
this.gotoParticipant(this.participants[0].id);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -201,9 +195,19 @@ export class CoreUserParticipantsComponent implements OnInit {
|
||||||
this.canLoadMore = result.canLoadMore;
|
this.canLoadMore = result.canLoadMore;
|
||||||
this.searchPage++;
|
this.searchPage++;
|
||||||
|
|
||||||
if (!loadMore && this.splitviewCtrl.isOn() && this.participants.length > 0) {
|
if (!loadMore && this.splitviewCtrl.isOn()) {
|
||||||
// Take first and load it.
|
// Load the first entry.
|
||||||
this.gotoParticipant(this.participants[0].id);
|
if (this.participants.length > 0) {
|
||||||
|
const found = this.participantId && this.participants.some((user) => user.id == this.participantId);
|
||||||
|
|
||||||
|
// The current selected user is not found in the current list, open first item.
|
||||||
|
if (!found) {
|
||||||
|
this.gotoParticipant(this.participants[0].id);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.participantId = null;
|
||||||
|
this.splitviewCtrl.emptyDetails();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
|
|
Loading…
Reference in New Issue