Guest User

Untitled

a guest
Nov 5th, 2018
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1. const pendingUsers: pendingUsersData [] = [{
  2. 'autoReLogin': false,
  3. 'rolesAccess': [{
  4. 'requestReason': 'because i need it',
  5. 'status': 'pending',
  6. 'role': 'API_ApplicationDeveloper'
  7. }],
  8. 'userId': 'f123132',
  9. 'emailId': 'me@google.com',
  10. 'firstName': 'Me',
  11. 'lastName': 'ME',
  12. 'country': 'IN'
  13. }, {
  14. 'autoReLogin': false,
  15. 'rolesAccess': [{
  16. 'requestReason': ' ',
  17. 'status': 'pending',
  18. 'role': 'API_ApplicationDeveloper'
  19. }],
  20. 'userId': 'F12455',
  21. 'emailId': 'ak@gmail.com',
  22. 'firstName': 'AKl',
  23. 'lastName': 'M',
  24. 'country': 'IN'
  25. }, {
  26. 'autoReLogin': false,
  27. 'rolesAccess': [{
  28. 'requestReason': ' ',
  29. 'status': 'pending',
  30. 'role': 'API_ApplicationDeveloper'
  31. }],
  32. 'userId': 'F14123',
  33. 'emailId': 'pg@gmail.com',
  34. 'firstName': 'Prs',
  35. 'lastName': 'Gpta',
  36. 'country': 'IN'
  37. }, {
  38. 'autoReLogin': false,
  39. 'rolesAccess': [{
  40. 'requestReason': 'exception_response_reason',
  41. 'status': 'pending',
  42. 'role': 'API_ApplicationDeveloper'
  43. }],
  44. 'userId': 'F99349',
  45. 'emailId': 'ank.sh@gmail.com',
  46. 'firstName': 'Ank',
  47. 'lastName': 'Shy',
  48. 'country': 'IN'
  49. }];
  50.  
  51. ngAfterViewInit() {
  52. this.pendingUsersDataSource.paginator = this.paginator.toArray()[0];
  53. this.pendingUsersDataSource.sort = this.sort.toArray()[0];
  54. this.pendingUsersDataSource.sortingDataAccessor = (item, property) => {
  55. switch (property) {
  56. case 'rolesAccess[0].requestReason': return item.rolesAccess[0].requestReason;
  57. default: return item[property];
  58. }
  59. };
  60.  
  61. this.dataSource.sortingDataAccessor = (item, property) => {
  62. if (property.includes('.')) return property.split('.').reduce((o,i)=>o[i], item);
  63. return item[property];
  64. };
Add Comment
Please, Sign In to add comment