Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

231
Views
angular2-datatable Not able to update data

After the datatable once get rendered , I am not able to update data. I am using angular2-datatable.

In my appcomponent.html:

If I update data2 in my appcomponent.ts file like this:

this.httpservice.getdata().subscribe
(data=>
{   this.data2=data;
    for (i = 0; i < 21; i++) {
    markerarray[i] = new google.maps.Marker({
    position: new google.maps.LatLng(this.data2[i].latituide, this.data2
    [i].longituide),          //In this line
    title: this.data2[i].name,  //and this
    map: map
    });
        }
    google.maps.event.addListener(map, 'idle', function () {

            var bounds = map.getBounds();
           for (var i = 0; i < 20; i++) {
            var marker = markerarray[i];
           if (bounds.contains(marker.getPosition()) === true) {
            this.data2.length=0;// This is not working for me
            }
            }

        });
 })

I want to empty the datatable once the markers are in bound.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

I figured out a solution , though I am not sure that this is the best way.

I have used ChangeDetectorRef for detecting changes.

  constructor(private http: Http,private httpservice: HttpService,private ref: ChangeDetectorRef) {
       ref.detach();
    setInterval(() => {
      this.ref.detectChanges();
    },1000);
    }
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!