Ember数据记录数据是被填写的状态 [英] Ember-data RecordArray isLoaded Status

查看:76
本文介绍了Ember数据记录数据是被填写的状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以向我解释为什么在Ajax调用之前甚至一个成功方法被调用之前,RecordArray状态 isLoaded 设置为true。



从ember数据源代码

  findAll:function(store ,type,since){
var root = this.rootForType(type);

this.ajax(this.buildURL(root),GET,{
data:this.sinceQuery(since),
success:function(json){
调试器
Ember.run(this,function(){
this.didFindAll(store,type,json);
});
}
} );
},

在视图中定义



$ pre> handler:function(){
var content,controller = this.get('controller');
if(controller.get('content.isLoaded')){
}
} .observes('controller.content.isLoaded')


解决方案

似乎有一个持续的错误, isLoaded 属性过早地设置在集合上。以下是GitHub上的相关问题


Can any one explain to me why a RecordArray status isLoaded is set to true before even a success method on an ajax call is called.

From ember-data source code

  findAll: function(store, type, since) {
    var root = this.rootForType(type);

    this.ajax(this.buildURL(root), "GET", {
      data: this.sinceQuery(since),
      success: function(json) {
          debugger;
        Ember.run(this, function(){
          this.didFindAll(store, type, json);
        });
      }
    });
  },

Defined in a view

handler: function() {        
    var content, controller = this.get('controller');
    if(controller.get('content.isLoaded')) {
    }
}.observes('controller.content.isLoaded')

解决方案

There appears to be an ongoing bug with isLoaded properties being set prematurely on collections. Here is the relevant issue on GitHub.

这篇关于Ember数据记录数据是被填写的状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆