Closed rullymartanto closed 6 years ago
Hi @rullymartanto and sorry for the late reply, perhaps you've solved this already but you're calling this.getUserList($event);
on the wrong event. As gt-info will be emitted whenever the table changes it will be triggered again with this.getUserList (my guess is that you update the table using that function right?).
You probably want to call your own function here too:
<input class="form-control form-control-sm mr-sm-2 mb-3 mb-sm-0" #search (keyup)="myTable.gtSearch(search.value)" placeholder="Search"/>
It should probably be:
<input class="form-control form-control-sm mr-sm-2 mb-3 mb-sm-0" #search (keyup)="getUserList(search.value)" placeholder="Search"/>
If your getUserList expects a search string that it will pass on to the server which should then return the new data along with the table info object containing number of pages, search terms etc. You don't need to call myTable.gtSearch(search.value)
as the server handles the search when lazy loading.
Well Great Thanks for response I appreciate that
hei, I have read this code
<input class="form-control form-control-sm mr-sm-2 mb-3 mb-sm-0" #search (keyup)="myTable.gtSearch(search.value)" placeholder="Search"/>
trigger($event) { switch ($event.name) { case 'gt-info': this.getUserList($event); break; default: console.log($event); break; } }
and my service
searchUsers(searchObject: GtInformation) { return this.http.post(this.config.apiUrl + '/users', searchObject, this.jwt()).map((response: Response) => response.json()); }
It's looping and doesn't stop
What is best way to do this ?
Thanks