Okay, thanks, hope you can help.
 I have this loadTreeView() that loads mat-treeview checkd objects..There 
are 3 tabs.
  I am concerned with the getObjects tab.  I need to know if the object tab 
treeviewitem data changes or not.before user clicks out of tab 
I need to know if he made a change.   I just need to know if the array 
Treeviewitems changed.    Length should work but the _objectsData gets 
saved to the backwend.
I shouldn't have to compare the backend object with the treeviewitems 
array.  that could be messy.  i should just be able to see if a checkbox 
changed. 
the trouble is the treeviewitems are loaded onInit.  So they aren't in the 
HTML so I can't write an event there.  I would have to write it in the 
loadtreeview function somewhere???
thanka,s
 
=============

The dialog is for when user forgets to save and changes tab which is what I 
need to display.
 In fact this is my dialog script.onLInkClick()  Its all I have to do,, see 
if the treeviewitems in loadTreeView checkboxes got changed and if the user 
tabs out then display dialog.
 onLinkClick(event: MatTabChangeEvent ) {
    if (this.objUpdatedFlag === true) {
       if(event.index=== 0 || event.index === 2) {
           this.openQuit();
      }
   }
}

=================
loadTreedata() {
      

        this.rmService.getObjects().subscribe(res => {
            console.log('Get Objects Results '+ JSON.stringify(res));
          
            
            res.map(item => {
                if (item.type == "WORKFLOW") {
                    let treeviewItems = 
item.objects[0].objects[0].objects.map(object => {
                        const data = {
                            text: object.name,
                            value: object.id
                        };
                        return data;
                        
                    });
                    this.objectItem.push(new TreeviewItem({
                        text: item.type,
                        value: 1,
                        collapsed: false,
                        children: [{
                            text: item.objects[0].type,
                            value: item.id,
                            children: [{
                                text: item.objects[0].objects[0].type,
                                value: item.id,
                                children: treeviewItems,
                            }],
                        }],

                    }));
                  
                }

                if (item.type == "REPORTS") {
                    let treeviewItems = item.objects[0].objects.map(object 
=> {
                        const data = {
                            text: object.name,
                            value: object.id
                        };
                        return data;
                    });
                    this.objectItem.push(new TreeviewItem({
                        text: item.type,
                        value: 0,
                        collapsed: false,
                        children: [{
                            text: item.objects[0].type,
                            value: item.id,
                            children: treeviewItems,
                        }],
                    }));
                }
            });
        });
    }
========================
  objectsApply() {
        this._objectsData = {
            id: this._selectedRole.id,
            name: this._selectedRole.name,
            features: this._selectedRole.features,
           objects: this.objectSelectedValues
       //   objects:[]
        }; 
   
This is the array in the Inspector:

   1. Array(3)
      1. 0: TreeviewItem {internalDisabled: false, internalChecked: true, 
      internalCollapsed: false, text: "Single", value: 
      "/workflow/Stacks/q:Scan/i:Single"}
      2. 1: TreeviewItem {internalDisabled: false, internalChecked: true, 
      internalCollapsed: false, text: "Multi", value: 
      "/workflow/Stacks/q:Scan/i:Multi"}
      3. 2: TreeviewItem {internalDisabled: false, internalChecked: true, 
      internalCollapsed: false, text: "Report 2", value: 
      "/reports/Status/n:report_2"}
      4. length: 3
   
There is an objectsApply() function but that happens after user clicks 
"save" button.  I need to do the test ****** below before saved button.  I 
can't figure out how to.  
  objectsApply() {
        this._objectsData = {
            id: this._selectedRole.id,
            name: this._selectedRole.name,
            features: this._selectedRole.features,
           objects: this.objectSelectedValues
       //   objects:[]
        }; 
   
   //console.log("Objects Data Apply"+ this._objectsData.objects)
        /* Validation for save button */
        if (this._selectedRole.objects.length != 
this._objectsData.objects.length) {       *********
            console.log("OBJECTS DATA " +this._objectsData.objects);
            /* _objectsData contains id, name, features & objects of a role 
and this is passed as parameter to SaveRole service */
            this.rmService.saveRole(this._objectsData)
                .subscribe(
                    res => {
                        /* getUpdatedRoles for getting the updated roles 
data */
                            this.getUpdatedRoles();
                        if (res == null) {
                            this.msgService.success('objectsSuccessMsg');
                        } else {
                            this.msgService.error('objectsFailedMsg');
                        }
                })           
            this._objectsData = [];
        }
    } 

On Friday, June 28, 2019 at 1:09:13 AM UTC-4, Sander Elias wrote:
>
> Hi J,
>
> I'm unsure what your question is. Did I understand it correctly that you 
> want to read out and parse back objectitem?
>
> Regards
> Sander
>

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to angular+unsubscr...@googlegroups.com.
To post to this group, send email to angular@googlegroups.com.
Visit this group at https://groups.google.com/group/angular.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/angular/ceb0be77-8922-4a16-9d1d-c0e8a55bf538%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to