Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- this.subscription.add(
- this.wbsService.currentWbsTreeListStore$.subscribe(
- (currentWbsTreeListStore) => {
- this.wbsTreeStore = currentWbsTreeListStore;
- this.showObsoleteCheckbox = new Checkbox({
- appendTo: 'showobsoletewbscheckbox',
- text: 'Show inactive nodes',
- cls: 'checkbox noselect',
- listeners: {
- action: (action) => {
- if (!action.checked) {
- this.wbsTreeStore.filter({
- id: 'showobsoletewbs',
- filterBy: (wbsNode) => !wbsNode.wbs_status_id && wbsNode.wbs_status_id === 0
- });
- if (!this.wbsTreeStore.records.find((foundRow) => foundRow.wbs_id === this.selectedWbsNode.wbs_id)) {
- this.wbsService.updateCurrentWbsNode(this.wbsTreeStore.records[0]);
- } // to ensure selection is being reset if the selected record is OBSOLETE
- } else {
- this.wbsTreeStore.removeFilter('showobsoletewbs');
- }
- }
- }
- });
- if (!this.showObsoleteCheckbox.checked) {
- this.wbsTreeStore.filter({
- id: 'showobsoletewbs',
- filterBy: (wbsNode) => !wbsNode.wbs_status_id && wbsNode.wbs_status_id === 0
- });
- if (!this.wbsTreeStore.records.find((foundRow) => foundRow.wbs_id === this.selectedWbsNode.wbs_id)) {
- this.wbsService.updateCurrentWbsNode(this.wbsTreeStore.first);
- } // to ensure selection is being reset if the selected record is OBSOLETE
- } else {
- this.wbsTreeStore.removeFilter('showobsoletewbs');
- }
- if (this.selectedWbsNode) {
- const foundWbsNode: WbsModel = currentWbsTreeListStore.find(
- (wbs) => wbs.wbs_id === this.selectedWbsNode.wbs_id
- ) as WbsModel;
- this.wbsService.updateCurrentWbsNode(foundWbsNode);
- }
- if (this.selectedWbs) {
- // const foundWbs : WbsModel = currentWbsTreeListStore.find((wbs) => wbs.wbs_id === this.selectedWbs.wbs_id) as WbsModel;
- // this.wbsService.updateCurrentWbs(foundWbs);
- const foundTopWbs: WbsModel = currentWbsTreeListStore.find(
- (wbs) => wbs.wbs_id === this.selectedWbs.wbs_id
- ) as WbsModel;
- this.wbsService.updateTopWbsNode(foundTopWbs);
- }
- }
- )
- );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement