I have a working, non-JSONAPI for fetching data using ember data. Its so far working great. Now since I expect to work with a lot of data, I need pagination as well as searching/filtering. I want when user types on search-box and presses Enter key ember should somehow call an API endpoint sending criteria and receiving the data that are filtered.
I have tried to follow this tutorial but despite being a little outdated, it doe not work on my case. I expected to define somewhere where adapter should fetch the search from API but so far I have not found any.
Current code does not send request to the API server at all but it fetches data initially just fine. The search does not work!
I will appreciate your comments.
Here is my code (I have not posted template for obvious reason that is, It works correctly) //controller import Ember from ‘ember’;
export default Ember.Controller.extend({
queryParams: ['id'],
id: "",
actions:{
search(term){
this.set("id", term);
}
}
});
//route
import Ember from 'ember';
export default Ember.Route.extend({
title:"Usimamizi wa pochi zote",
queryParams: {
id: {
refreshModel: true
}
},
model(params) {
console.log(params);
return this.store.findAll('wallet', params);
}
});