Click here to Skip to main content
14,545,210 members
Rate this:
Please Sign up or sign in to vote.
I have field total count I need to prevent total Count from display on component.html

I already do it but not working if you can tell me how to do that ?

I display data dynamically on header column and body data with angular 7

I try using filter function below but not working


data object represent following data as any[]

companyName: "Innovasic, Inc."
done: "0"
notImpacted: "0"
notificationDate: "2009-11-12"
offilneURL: "https://source.z2data.com/2019/1/13/8/55/47/351/662203977/21527_SPCN.PDF"
onlineURL: "N/A"
pending: "3"
reportDate: "2020-05-07"
revisionID: "272299243"
teamName: "MFG"
totalCount: 79


What I have tried:

this._displayreport.GetReportDetailsPaging(this.searchData).subscribe((data: any[]) => {

        this.reportdetailslist = data;
  this.headerCols = Object.keys(data[0]);
  this.contentBody=data.filter(item =>item != data[0].totalCount);

      });


    }


  }


<thead>
                  <tr>
                    <th >
                      <ng-container *ngIf="coln != 'totalCount'">

                        {{coln}}
                      </ng-container>
                    </th>


                  </tr>
                </thead>
                <tbody>

                    <tr *ngFor="let rep of contentBody">

                      <td *ngFor="let coln of headerCols">


                        <span> 

                        {{rep[coln]}}
                        </span>
                       </td>
                       </tr>
                      <tbody>
Posted
Updated 24-May-20 16:07pm
Comments
ZurdoDev 21-May-20 12:56pm
   
I don't see a footer row? Where is the total showing up?
ahmed_sa 22-May-20 19:44pm
   
thank you for reply i need to prevent it from display by using filter because totalCount display as last column on table
and i dont need to display it
Rate this:
Please Sign up or sign in to vote.

Solution 1

thank you for reply
it solved by following code
on component.ts

this.headerCols = Object.keys(data[0]).filter(x => x !== 'totalCount');
   
Rate this:
Please Sign up or sign in to vote.

Solution 2

thank you for reply
it solved by following code
on component.ts

this.headerCols = Object.keys(data[0]).filter(x => x !== 'totalCount');
   
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100