0

I have a view in emberjs that shows results that are on the ember data store, I have a search function that updates the results in the store via rest and so on, however the issue I have is that when the store gets updated it doesn't show it on the view, unless I delete all the records and then fill them again, but if I do that, then results that would've had the same id don't show up, as they were deleted I assume and ember ignores them.

is there a way to clear out the data store without deleting them so that they can still show up?

so far these are the 2 methods I tried.

this.store.unloadAll('things');

this.store.all('things').forEach(function(record){
                 record.deleteRecord();
             })

both have the same issue.

Thanks

ShinySides
  • 428
  • 3
  • 13
  • Potential duplicate of http://stackoverflow.com/questions/14181223/how-to-reload-an-ember-data-record ? – borisrorsvort Jan 07 '14 at 16:36
  • No it seems like there's something totally wrong here, I've been doing a bit of testing to see, and when I do a query I get the results back and they go into the ember data, then I do a different query, I first clear the old data, then I do the query and get the results back and they all go on the ember data store, now if I go back and do the same query as before, there is no records, starting from the store.find(), and I've looked at the json that response and it does have data there, so somehow ember is refusing it. – ShinySides Jan 07 '14 at 17:24

1 Answers1

0

Ok I figured it out, all I had to do was use unleadRecord(), lack of documentation does make it a bit harder to find, so it will just work like this

this.store.all('things').forEach(function(record){
                 record.unloadRecord();
             })
ShinySides
  • 428
  • 3
  • 13