ember.js - Model isn’t updating when I use a query -


the model automatically updates if use:

st.filterssymbolsroute = ember.route.extend({   model: function() {   return this.store.find('filter');   } }); 

but when introduce query, model not automatically update:

st.filterssymbolsroute = ember.route.extend({   model: function() {   return this.store.find('filter', {issymbol: true});   } }); 

here's fiddle: http://jsbin.com/yeyiroyo/1/2

to replicate bug, click symbols, click "+", type something, , hit enter you'll notice nothing happens, if click users, symbols again -- you'll notice model has updated. how can make update immediately?

i think need have hook refreshes model here:

filter.save().then(function(){   //reload model }); 

the query going return record array not individual record.

  model: function() {     return this.store.find('filter', {issymbol: true}).then(        function(results) {         return results.get('firstobject')       }     );   } 

if want return record array , have populate automatically do:

model: function() {    return this.store.filter('filter', {issymbol: true}, function(record) {       return record.get('issymbol') === true;    }); } 

here write up.

http://emberjs.com/guides/models/frequently-asked-questions/


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

android - Keyboard hides my half of edit-text and button below it even in scroll view -

css - Make div keyboard-scrollable in jQuery Mobile? -