Advertisement
psi_mmobile

Untitled

Oct 28th, 2024
16
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.59 KB | None | 0 0
  1. this.subscription.add(
  2. this.wbsService.currentWbsTreeListStore$.subscribe(
  3. (currentWbsTreeListStore) => {
  4. this.wbsTreeStore = currentWbsTreeListStore;
  5. this.showObsoleteCheckbox = new Checkbox({
  6. appendTo: 'showobsoletewbscheckbox',
  7. text: 'Show inactive nodes',
  8. cls: 'checkbox noselect',
  9. listeners: {
  10. action: (action) => {
  11. if (!action.checked) {
  12. this.wbsTreeStore.filter({
  13. id: 'showobsoletewbs',
  14. filterBy: (wbsNode) => !wbsNode.wbs_status_id && wbsNode.wbs_status_id === 0
  15. });
  16. if (!this.wbsTreeStore.records.find((foundRow) => foundRow.wbs_id === this.selectedWbsNode.wbs_id)) {
  17. this.wbsService.updateCurrentWbsNode(this.wbsTreeStore.records[0]);
  18. } // to ensure selection is being reset if the selected record is OBSOLETE
  19. } else {
  20. this.wbsTreeStore.removeFilter('showobsoletewbs');
  21. }
  22. }
  23. }
  24. });
  25.  
  26. if (!this.showObsoleteCheckbox.checked) {
  27. this.wbsTreeStore.filter({
  28. id: 'showobsoletewbs',
  29. filterBy: (wbsNode) => !wbsNode.wbs_status_id && wbsNode.wbs_status_id === 0
  30. });
  31. if (!this.wbsTreeStore.records.find((foundRow) => foundRow.wbs_id === this.selectedWbsNode.wbs_id)) {
  32. this.wbsService.updateCurrentWbsNode(this.wbsTreeStore.first);
  33. } // to ensure selection is being reset if the selected record is OBSOLETE
  34. } else {
  35. this.wbsTreeStore.removeFilter('showobsoletewbs');
  36. }
  37.  
  38. if (this.selectedWbsNode) {
  39. const foundWbsNode: WbsModel = currentWbsTreeListStore.find(
  40. (wbs) => wbs.wbs_id === this.selectedWbsNode.wbs_id
  41. ) as WbsModel;
  42. this.wbsService.updateCurrentWbsNode(foundWbsNode);
  43. }
  44. if (this.selectedWbs) {
  45. // const foundWbs : WbsModel = currentWbsTreeListStore.find((wbs) => wbs.wbs_id === this.selectedWbs.wbs_id) as WbsModel;
  46. // this.wbsService.updateCurrentWbs(foundWbs);
  47. const foundTopWbs: WbsModel = currentWbsTreeListStore.find(
  48. (wbs) => wbs.wbs_id === this.selectedWbs.wbs_id
  49. ) as WbsModel;
  50. this.wbsService.updateTopWbsNode(foundTopWbs);
  51. }
  52. }
  53. )
  54. );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement